diff --git a/handler.ts b/handler.ts index 0a8335e..15cc4b3 100644 --- a/handler.ts +++ b/handler.ts @@ -8,7 +8,7 @@ function setXResponseTimeHeader(ctx: C, startTime: number) { ctx.response.headers.set("X-Response-Time", `${ms}ms`); } -function assertError(caught: unknown): Error { +export function assertError(caught: unknown): Error { return caught instanceof Error ? caught : new Error("[non-error thrown]"); } diff --git a/mod.ts b/mod.ts index e10df20..caa9e1f 100644 --- a/mod.ts +++ b/mod.ts @@ -1,5 +1,5 @@ export { listen } from "./server.ts"; export { Context } from "./context.ts"; export * from "./route.ts"; -export { createHandler, type Handler } from "./handler.ts"; +export { assertError, createHandler, type Handler } from "./handler.ts"; export { compose, composeSync } from "./composition.ts";