/Knowledge/sources/honojs__hono/llms-full/rpc-global-response--8d100ecc17ad.md
RPC: Global Response - hono-docs
RPC: Global Response Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt global response Summary Hono RPC...
RPC: Global Response
Source evidence: /Sources/honojs__hono/provenance.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:
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#global-response",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / RPC > Global Response (1)",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 51,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "RPC: Global Response",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}