/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-global-response-f433bf2f2622-global-response-s0051-c0000.md
Global Response (1) - hono-docs
Global Response (1) Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt global response Summary Hono...
Global Response (1)
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#global-response
Summary
Hono RPC client doesn't automatically infer response types from global error handlers like app.onError() or global middleware. You can use the ApplyGlobalResponse type helper to merge global error response types into all routes. ```t...
Content
Hono RPC client doesn't automatically infer response types from global error handlers like app.onError() or global middleware. You can use the ApplyGlobalResponse type helper to merge global error response types into all routes.
import type { ApplyGlobalResponse } from 'hono/client'
const app = new Hono()
.get('/api/users', (c) => c.json({ users: ['alice', 'bob'] }, 200))
.onError((err, c) => c.json({ error: err.message }, 500))
type AppWithErrors = ApplyGlobalResponse<
typeof app,
{
500: { json: { error: string } }
}
>
const client = hc<AppWithErrors>('http://localhost')Now the client knows about both success and error responses: