Represents a generic validation error. Extends the native Error class.

Hierarchy (View Summary)

Constructors

Properties

message: string
name: string
stack?: string
prepareStackTrace?: (err: Error, stackTraces: CallSite[]) => any

Optional override for formatting stack traces

stackTraceLimit: number

Methods

  • Asserts a condition and throws a ValidationError if the condition is false.

    Parameters

    • condition: unknown

      The condition to assert.

    • message: string

      The error message to throw if the assertion fails.

    Returns asserts condition

    ValidationError.assert(someCondition, "Condition failed");
    
  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void