Class XtInvalidError

An error type thrown when a value fails a validation function test.

Several features inherited from

See

XtError

Example

const isString = (value) => typeof value === 'string'

new XtInvalidError(2, isString)
//=> XtInvalidError: Expected 'isString' to return 'true' for input: 2

new XtInvalidError('Adam', isString, false)
//=> XtInvalidError: Expected 'isString' to return 'false' for input: Adam

Hierarchy

Constructors

Properties

cause?: unknown
frames: [string, string][] = []

Parsed stack trace.

message: string
name: string
stack?: string
prepareStackTrace?: ((err, stackTraces) => any)

Type declaration

stackTraceLimit: number

Methods

  • Renders the error-message, stack-trace and any other own-properties as a colorful formatted string that is easy to read when printed to in the terminal.

    Returns undefined | string

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

Generated using TypeDoc