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

Function statusCodeForNormalizedError

src/daemon/http-errors.ts:6–17  ·  view source on GitHub ↗
(code: string)

Source from the content-addressed store, hash-verified

4export type NormalizedHttpError = ReturnType<typeof normalizeError>;
5
6export function statusCodeForNormalizedError(code: string): number {
7 switch (code) {
8 case 'INVALID_ARGS':
9 return 400;
10 case 'UNAUTHORIZED':
11 return 401;
12 case 'SESSION_NOT_FOUND':
13 return 404;
14 default:
15 return 500;
16 }
17}
18
19export function sendRestJsonError(res: http.ServerResponse, normalized: NormalizedHttpError): void {
20 res.statusCode = statusCodeForNormalizedError(normalized.code);

Callers 3

handleArtifactDownloadFunction · 0.90
createDaemonHttpServerFunction · 0.90
sendRestJsonErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected