MCPcopy Create free account
hub / github.com/cloudflare/computer / errorJSON

Function errorJSON

examples/worker-javascript/src/index.ts:149–156  ·  view source on GitHub ↗
(error: unknown, status: number)

Source from the content-addressed store, hash-verified

147}
148
149function errorJSON(error: unknown, status: number): Response {
150 const message = error instanceof Error ? error.message : String(error);
151 const code = (error as { code?: string }).code;
152 return new Response(JSON.stringify({ error: message, code }), {
153 status,
154 headers: { "content-type": "application/json" },
155 });
156}

Callers 3

fetchFunction · 0.70
handleFileFunction · 0.70
handleExecFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected