ow
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Predicate<Error>
    • ErrorPredicate

Implements

  • BasePredicate<Error>

Index

Accessors

evalError

  • get evalError(): this

not

  • get not(): this

rangeError

  • get rangeError(): this

referenceError

  • get referenceError(): this

syntaxError

  • get syntaxError(): this

typeError

  • get typeError(): this

uriError

  • get uriError(): this

Methods

Protected addValidator

  • addValidator(validator: Validator<Error>): this
  • Register a new validator.

    Parameters

    • validator: Validator<Error>

      Validator to register.

    Returns this

hasKeys

  • hasKeys(...keys: readonly string[]): this
  • Test the error object to have specific keys.

    Parameters

    • Rest ...keys: readonly string[]

      One or more keys which should be part of the error object.

    Returns this

instanceOf

  • instanceOf(instance: Function): this
  • Test an error to be of a specific instance type.

    Parameters

    • instance: Function

      The expected instance type of the error.

    Returns this

is

  • is(validator: (value: Error) => boolean | string): this
  • Test if the value matches a custom validation function. The validation function should return true if the value passes the function. If the function either returns false or a string, the function fails and the string will be used as error message.

    Parameters

    • validator: (value: Error) => boolean | string

      Validation function.

        • (value: Error): boolean | string
        • Parameters

          • value: Error

          Returns boolean | string

    Returns this

message

  • message(expected: string): this
  • Test an error to have a specific message.

    Parameters

    • expected: string

      Expected message of the Error.

    Returns this

messageIncludes

  • messageIncludes(message: string): this
  • Test the error message to include a specific message.

    Parameters

    • message: string

      Message that should be included in the error.

    Returns this

name

  • name(expected: string): this
  • Test an error to have a specific name.

    Parameters

    • expected: string

      Expected name of the Error.

    Returns this

validate

  • Test if the value matches a custom validation function. The validation function should return an object containing a validator and message. If the validator is false, the validation fails and the message will be used as error message. If the message is a function, the function is invoked with the label as argument to let you further customize the error message.

    Parameters

    Returns this