Function: errorHandler()
errorHandler(
err,c):Response|Promise<Response>
Defined in: src/api/middleware/error-handler.ts:119
Error handler for Hono application.
Parameters
err
Error | HTTPResponseError
c
Context<ChiveEnv>
Returns
Response | Promise<Response>
Remarks
Handles all errors thrown in route handlers and middleware:
- ChiveError subclasses are mapped to appropriate HTTP status codes
- Error details are logged with request context
- Response includes request ID for support correlation
- Internal error details are not exposed in production
Example
const app = new Hono<ChiveEnv>();
app.onError(errorHandler);