function validationError
Since 0.1.0
validationError(
errors: readonly ValidationError[],
message?: string
): HttpError

Creates a 422 Unprocessable Entity error wrapping a list of validation failures.

The errors array is stored in the error's details.errors so it survives serialization into both the default and RFC 7807 error bodies.

Parameters

errors: readonly ValidationError[]

The validation failures that caused this error

optional
message: string

Optional custom message (defaults to a count-based summary)

Return Type

Usage

import { validationError } from "exceptions/src/index.ts";