MCPcopy Index your code
hub / github.com/callstack/agent-device / sendProxyError

Function sendProxyError

src/remote/daemon-proxy.ts:421–430  ·  view source on GitHub ↗
(res: ServerResponse, error: unknown)

Source from the content-addressed store, hash-verified

419}
420
421function sendProxyError(res: ServerResponse, error: unknown): void {
422 if (res.headersSent) {
423 res.destroy(error instanceof Error ? error : undefined);
424 return;
425 }
426 const normalized = normalizeError(error);
427 res.statusCode = normalized.code === 'INVALID_ARGS' ? 400 : 500;
428 res.setHeader('content-type', 'application/json');
429 res.end(JSON.stringify({ ok: false, error: normalized.message, code: normalized.code }));
430}

Callers 1

createDaemonProxyServerFunction · 0.85

Calls 1

normalizeErrorFunction · 0.90

Tested by

no test coverage detected