interface ErrorResponderTarget
Since 0.1.0

The minimal context an error responder needs to write a response: the request-scoped state (where the responder itself is published), the response builder to write to, and the request (for the Problem Details instance).

IRequestContext is structurally assignable to this, so middleware passes its full context while the kernel's pre-pipeline sites — the shutdown drain and the malformed-request 400, which run before a context exists, and the request-lifecycle hooks, which run before the pipeline — pass a bare object or a freshly created context. The kernel seeds the application's resolved responder into that state (from the pipeline's brand, see ERROR_RESPONDER_BRAND) before the site runs, so even a pre- pipeline site answers in the configured format when an errorHandler is registered; without one, the state carries no responder and the fallback shape is written.

Properties

readonly
state: Map<string, unknown>

Request-scoped state; the responder is published under ERROR_RESPONDER_STATE_KEY.

The response builder to write the error response to.

readonly
optional
request: { readonly path: string; }

The request, when one exists (supplies the Problem Details instance).

Usage

import { type ErrorResponderTarget } from "common/src/index.ts";