MCPcopy
hub / github.com/coder/mux / normalizeError

Function normalizeError

src/node/utils/streamErrors.ts:9–19  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

7}
8
9function normalizeError(error: unknown): Error {
10 if (error instanceof Error) {
11 return error;
12 }
13
14 if (typeof error === "string") {
15 return new Error(error);
16 }
17
18 return new Error("Unknown error");
19}
20
21function getErrorCode(error: unknown): string | undefined {
22 if (!error || typeof error !== "object") {

Callers 1

handlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected