Skip to content

@adrianhall/cloudflare-toolkit


@adrianhall/cloudflare-toolkit / lib/hono / ProblemDetailsErrorHandlerOptions

Interface: ProblemDetailsErrorHandlerOptions

Defined in: src/lib/hono/error-handler.ts:20

Options for problemDetailsErrorHandler.

Properties

autoInstance?

optional autoInstance?: boolean

Defined in: src/lib/hono/error-handler.ts:39

When true, populate instance from the request path (c.req.path) if the thrown problem didn't specify one. Explicit values always win.

Default: false — opt-in to avoid silently changing response shape.


defaultType?

optional defaultType?: string

Defined in: src/lib/hono/error-handler.ts:24

Default type URI. Defaults to "about:blank".


includeStack?

optional includeStack?: boolean

Defined in: src/lib/hono/error-handler.ts:32

Include the stack trace on unhandled Error responses (500). The stack is emitted as a top-level stack extension member per RFC 9457 §3.1 flattening, not in detail, to prevent leakage into UIs that render detail verbatim.

Security-sensitive: development-only, must default to false.


localize?

optional localize?: (pd, c) => Partial<ProblemDetails<Record<string, unknown>>> | undefined

Defined in: src/lib/hono/error-handler.ts:47

Localize title/detail before sending the response. Returned fields are merged onto the original ProblemDetails, so callers may return a partial patch (e.g. { title: "..." }) or omit the return entirely.

Parameters

pd

ProblemDetails

c

Context

Returns

Partial<ProblemDetails<Record<string, unknown>>> | undefined


mapError?

optional mapError?: (error) => ProblemDetailsInput<Record<string, unknown>> | undefined

Defined in: src/lib/hono/error-handler.ts:41

Custom error to ProblemDetailsInput mapping.

Parameters

error

Error

Returns

ProblemDetailsInput<Record<string, unknown>> | undefined


typePrefix?

optional typePrefix?: string

Defined in: src/lib/hono/error-handler.ts:22

Prefix for the type URI. When set, a status-derived slug is appended.