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

Function errorJSON

examples/container/src/index.ts:243–250  ·  view source on GitHub ↗
(error: unknown, status: number)

Source from the content-addressed store, hash-verified

241}
242
243function errorJSON(error: unknown, status: number): Response {
244 const message = error instanceof Error ? error.message : String(error);
245 const code = (error as { code?: string }).code;
246 return new Response(JSON.stringify({ error: message, code }), {
247 status,
248 headers: { "content-type": "application/json" },
249 });
250}
251
252function shellQuote(arg: string): string {
253 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