MCPcopy Create free account
hub / github.com/elysiajs/node / errorToResponse

Function errorToResponse

src/handle.ts:675–687  ·  view source on GitHub ↗
(error: Error, set?: Context['set'])

Source from the content-addressed store, hash-verified

673}
674
675export const errorToResponse = (error: Error, set?: Context['set']) =>
676 new Response(
677 JSON.stringify({
678 name: error?.name,
679 message: error?.message,
680 cause: error?.cause
681 }),
682 {
683 status:
684 set?.status !== 200 ? ((set?.status as number) ?? 500) : 500,
685 headers: set?.headers as any
686 }
687 )
688
689export const createStaticHandler = (
690 handle: unknown,

Callers 3

mapResponseFunction · 0.85
mapEarlyResponseFunction · 0.85
mapCompactResponseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected