read the expert Ids from the db not hardcoded from every flow

This commit is contained in:
2026-11-09 16:31:25 +03:30
parent 6cc59b1777
commit 6775635a81
10 changed files with 604 additions and 163 deletions
+2 -19
View File
@@ -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 {