import type { Plugin } from './app'; /** An [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem document. */ export interface ProblemDocument { /** A URI identifying the problem type. `about:blank` when unspecified. */ type: string; /** A short, human-readable summary of the problem type; the plugin fills it from the status's reason phrase (e.g. `"Not Found"`). */ title: string; /** The HTTP status code; must equal the `Response`'s own status. */ status: number; /** A human-readable explanation specific to this occurrence. */ detail?: string; /** A URI reference identifying the specific occurrence (the request path). */ instance?: string; /** Extension members (e.g. a machine-readable `code`). */ [key: string]: unknown; } /** * Plugin: render errors as [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) * `application/problem+json` instead of the default JSON envelope. An * `HttpError` becomes a problem document carrying its status, a title, the * message as `detail`, the request path as `instance`, and any `code`/`details` * as extension members; an unknown error becomes an opaque `500` whose message * is never leaked. Opt-in, so existing error shapes are unchanged until added. * * ```ts * const app = await createApp({ plugins: [problemDetails()] }) * // throw new NotFoundError("user 5") → 404 application/problem+json * ``` * * @returns a plugin whose error handler renders `application/problem+json` */ export declare function problemDetails(): Plugin; //# sourceMappingURL=problem-details.d.ts.map