function respondWithError
Since 0.1.0
respondWithError(): void

Responds to an error in the application's configured format.

Reads the responder published under ERROR_RESPONDER_STATE_KEY and delegates to it. When no conforming responder is present — no errorHandler registered at all — writes the framework-default { error: title } body (plus detail when the init carries one) as application/json, byte-identical to the shape the framework wrote before this seam existed. The kernel's pre-pipeline sites (the drain 503, the malformed-request 400, and the request-lifecycle-hook failures) run before any middleware, so the kernel seeds the application's resolved responder — read from the pipeline's ERROR_RESPONDER_BRAND — into their state before this call; with an errorHandler registered they answer in the configured format exactly like every in-pipeline site.

A state value that is not a conforming responder is ignored (the fallback is written) rather than thrown through, so a misconfigured or third-party state value can never turn an error response into a 500.

Parameters

The context (state, response, request) to write into

The error to respond with

Return Type

void

Usage

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