Skip to content

@adrianhall/cloudflare-toolkit


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

Function: problemDetailsErrorHandler()

problemDetailsErrorHandler(options?): ErrorHandler

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

Create an app.onError handler that returns RFC 9457 Problem Details responses. Handles ProblemDetailsError, Hono HTTPException, and unhandled exceptions.

Parameters

options?

ProblemDetailsErrorHandlerOptions = {}

Options controlling type URI construction, stack-trace exposure, instance auto-population, custom error mapping, and localization.

Returns

ErrorHandler

A Hono ErrorHandler.

Example

ts
import { Hono } from "hono";
import { problemDetailsErrorHandler } from "@adrianhall/cloudflare-toolkit/hono";

const app = new Hono();
app.onError(problemDetailsErrorHandler());