MCPcopy Create free account
hub / github.com/cloudflare/serverless-registry / errorString

Function errorString

src/utils.ts:48–58  ·  view source on GitHub ↗
(err: unknown)

Source from the content-addressed store, hash-verified

46}
47
48export function errorString(err: unknown): string {
49 if (err instanceof ZodError) {
50 return `zod error:\n${prettifyError(err)}`;
51 }
52
53 if (err instanceof Error) {
54 return `error ${err.name}: ${err.message}: ${err.cause}: ${err.stack}`;
55 }
56
57 return "unknown error: " + JSON.stringify(err);
58}
59
60export async function wrap<T, E = unknown>(fn: Promise<T>): Promise<[T, null] | [null, E]> {
61 return fn.then((data) => [data, null] as [T, null]).catch((err) => [null, err as unknown as E] as [null, E]);

Callers 11

router.tsFile · 0.90
checkCredentialsMethod · 0.90
authenticateBearerMethod · 0.90
manifestExistsMethod · 0.90
getManifestMethod · 0.90
layerExistsMethod · 0.90
getLayerMethod · 0.90
listReferrersMethod · 0.90
registriesFunction · 0.90
wrapErrorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected