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

    Class SimpleErrorReporter

    SimpleErrorReporter collects validation error messages as an array of objects. It's the default error reporter used by Vine and provides a simple, structured format for validation errors.

    Each error object contains:

    • message: Human-readable error message
    • field: The field path where validation failed
    • rule: The validation rule that failed
    • index: Array index (for array element errors)
    • meta: Additional error metadata
    const reporter = new SimpleErrorReporter()
    // After validation errors are reported:
    console.log(reporter.errors)
    // [{ message: "Required", field: "email", rule: "required" }]

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    hasErrors: boolean = false

    Flag indicating whether any validation errors have been reported

    errors: SimpleError[] = []

    Collection of all reported validation errors

    Methods

    • Report a validation error by adding it to the errors collection.

      Parameters

      • message: string

        The human-readable error message

      • rule: string

        The name of the validation rule that failed

      • field: FieldContext

        The field context containing field path and metadata

      • Optionalmeta: Record<string, any>

        Optional additional metadata about the error

      Returns void