Skip to content

covenix / covenixErrorHandler

Function: covenixErrorHandler()

covenixErrorHandler(options?): ErrorRequestHandler

Defined in: src/errors.ts:117

Optional convenience Express error middleware. Renders a CovenixError (ValidationError/SecurityError) as an RFC 9457 Problem Details object with Content-Type: application/problem+json, and passes every other error through untouched so it composes with a caller's own handlers. You are never required to use it — match on CovenixError yourself for full control.

Parameters

options?

CovenixErrorHandlerOptions = {}

Optional formatError override (switches the body to application/json).

Returns

ErrorRequestHandler

An Express error-handling middleware.