@vinejs/vine - v4.0.0-next.1
    Preparing search index...

    Class ValidationError

    ValidationError is a specialized Error class that represents validation failures. It contains structured error messages and HTTP status information for easy integration with web frameworks.

    try {
    await vine.validate({ schema, data })
    } catch (error) {
    if (error instanceof ValidationError) {
    console.log(error.messages) // Structured validation errors
    console.log(error.status) // HTTP 422
    }
    }

    Hierarchy

    • Error
      • ValidationError
    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    • Creates a new ValidationError with structured error messages.

      Parameters

      • messages: any

        Structured validation error messages

      • Optionaloptions: ErrorOptions

        Optional error options for the base Error class

      Returns ValidationError

    Properties

    status: number = 422

    HTTP status code for the validation error (422 Unprocessable Entity)

    code: string = 'E_VALIDATION_ERROR'

    Internal error code for programmatic error handling

    messages: any

    Structured validation error messages

    Accessors

    • get "[toStringTag]"(): string

      Returns the string tag for this object type.

      Returns string

      The constructor name of this error

    Methods

    • Returns a string representation of the validation error.

      Returns string

      Formatted error string with name, code, and message