Skip to content

errorToResponse

errorToResponse(error, requestId?): Response

Defined in: src/core/errors.ts:69

Build a JSON Response from a GatewayError.

Merges any custom headers from the error (e.g. Retry-After) into the response. Includes the request ID when available for tracing.

GatewayError

The gateway error to convert.

string

Optional request ID to include in the response body.

Response

A Response with JSON body and appropriate status code.