Interface ParseError

The ParseError type is the error object returned by the validation functions. It contains the name of the error, a message, and optionally the path to the error in the parsed object. Additionally, it can contain a sub-errors array that lists the different failure cases of the either schema.

interface ParseError {
    errors?: ParseError[];
    message: string;
    name: ParseErrorName;
    path?: ErrorPath;
}

Properties

errors?: ParseError[]

If the validated value is an union (either), this property contains errors for each of the union members.

message: string

A human-readable message for the error.

The name of the error.

path?: ErrorPath

If the validated value is a construct, like an array or an object, this property contains the path to follow to find the incriminated value that is causing the validation to fail.