MCPcopy
hub / github.com/freshframework/fresh / DEFAULT_ERROR_HANDLER

Function DEFAULT_ERROR_HANDLER

packages/fresh/src/app.ts:51–66  ·  view source on GitHub ↗
(ctx: Context<State>)

Source from the content-addressed store, hash-verified

49};
50// deno-lint-ignore require-await
51const DEFAULT_ERROR_HANDLER = async <State>(ctx: Context<State>) => {
52 const { error } = ctx;
53
54 if (error instanceof HttpError) {
55 if (error.status >= 500) {
56 // deno-lint-ignore no-console
57 console.error(error);
58 }
59 const message = error.message || STATUS_TEXT[error.status];
60 return new Response(message, { status: error.status });
61 }
62
63 // deno-lint-ignore no-console
64 console.error(error);
65 return new Response("Internal server error", { status: 500 });
66};
67
68export type ListenOptions =
69 & Partial<

Callers 1

handlerMethod · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected