Error Handling
Define custom error handlers to handle all errors in your app.
Usage
typescript
const app = new Kyrin({
onError: (err, c) => {
console.error(err);
return c.json({ error: err.message }, 500);
}
});Validation Errors
Kyrin automatically handles Zod validation errors and returns 400 Bad Request. See Routes for more details.
Default Behavior
If you don't define onError:
- Development mode: Shows error details with stack trace
- Production mode: Shows "Internal Server Error" only