/Knowledge/sources/honojs__hono/llms-full/app-hono-error-handling--bd141d257dd4.md
App - Hono: Error Handling - hono-docs
App Hono: Error Handling Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt error handling Summary app.on...
App - Hono: Error Handling
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#error-handling
Summary
app.onError allows you to handle uncaught errors and return a custom Response. ```ts twoslash import { Hono } from 'hono' const app = new Hono() // ---cut--- app.onError((err, c) => { console.error(${err}) return c.text('Custom Error...
Content
app.onError allows you to handle uncaught errors and return a custom Response.
import { Hono } from 'hono'
const app = new Hono()
// ---cut---
app.onError((err, c) => {
console.error(`${err}`)
return c.text('Custom Error Message', 500)
})
::: info
If both a parent app and its routes have onError handlers, the route-level handlers get priority.
:::
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#error-handling",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / App - Hono > Error Handling",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 619,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "App - Hono: Error Handling",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}