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

Function errorJSON

examples/worker-shell/src/index.ts:203–210  ·  view source on GitHub ↗
(error: unknown, status: number)

Source from the content-addressed store, hash-verified

201}
202
203function errorJSON(error: unknown, status: number): Response {
204 const message = error instanceof Error ? error.message : String(error);
205 const code = (error as { code?: string }).code;
206 return new Response(JSON.stringify({ error: message, code }), {
207 status,
208 headers: { "content-type": "application/json" },
209 });
210}
211
212function shellQuote(arg: string): string {
213 if (/^[A-Za-z0-9_\-+=:,./@%]+$/.test(arg)) return arg;

Callers 3

fetchFunction · 0.70
handleFileFunction · 0.70
handleExecFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected