MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / normalizeErrorMessage

Function normalizeErrorMessage

packages/producer/src/utils/errorMessage.ts:14–31  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

12 * 6. `"unknown error"` for null / undefined
13 */
14export function normalizeErrorMessage(error: unknown): string {
15 if (error instanceof Error) return error.message;
16 if (typeof error === "string") return error;
17 if (typeof error === "object" && error !== null) {
18 const msg = (error as Record<string, unknown>).message;
19 if (typeof msg === "string") return msg;
20 try {
21 return JSON.stringify(error);
22 } catch {
23 try {
24 return `{${Object.keys(error as object).join(", ")}}`;
25 } catch {
26 /* truly opaque object */
27 }
28 }
29 }
30 return String(error ?? "unknown error");
31}

Callers 8

describeMemoryExhaustionFunction · 0.50
executeRenderJobFunction · 0.50
stageErrorMethod · 0.50
constructorMethod · 0.50
buildRenderErrorDetailsFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected