forked from Yara724/api
read the expert Ids from the db not hardcoded from every flow
This commit is contained in:
@@ -4,6 +4,7 @@ import { isAxiosError, type AxiosResponse } from "axios";
|
||||
import { Model, Types } from "mongoose";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import type { FanavaranAuditSession } from "./fanavaran-audit.types";
|
||||
import { extractFanavaranOriginalMessage } from "./fanavaran-http-exception";
|
||||
import {
|
||||
FanavaranAuditLog,
|
||||
FanavaranAuditLogDocument,
|
||||
@@ -236,25 +237,7 @@ export class FanavaranAuditService {
|
||||
}
|
||||
|
||||
extractErrorMessage(error: unknown): string {
|
||||
if (isAxiosError(error)) {
|
||||
const data = error.response?.data as
|
||||
| { Message?: string; message?: string }
|
||||
| string
|
||||
| undefined;
|
||||
if (typeof data === "string") {
|
||||
return data;
|
||||
}
|
||||
return (
|
||||
data?.Message ||
|
||||
data?.message ||
|
||||
error.message ||
|
||||
"Fanavaran request failed"
|
||||
);
|
||||
}
|
||||
if (error instanceof Error) {
|
||||
return error.message;
|
||||
}
|
||||
return "Fanavaran request failed";
|
||||
return extractFanavaranOriginalMessage(error, "Fanavaran request failed");
|
||||
}
|
||||
|
||||
formatErrorWithTrackingCode(message: string, trackingCode?: string): string {
|
||||
|
||||
Reference in New Issue
Block a user