Bun

class

assert.default.AssertionError

class AssertionError

Indicates the failure of an assertion. All errors thrown by the node:assert module will be instances of the AssertionError class.

  • actual: unknown

    Set to the actual argument for methods such as ().

  • cause?: unknown

    The cause of the error.

  • code: 'ERR_ASSERTION'

    Value is always ERR_ASSERTION to show that the error is an assertion error.

  • expected: unknown

    Set to the expected argument for methods such as ().

  • generatedMessage: boolean

    Indicates if the message was auto-generated (true) or not.

  • message: string
  • name: string
  • operator: string

    Set to the passed in operator value.

  • stack?: string
  • static stackTraceLimit: number

    The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

    The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

    If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

  • targetObject: object,
    constructorOpt?: Function
    ): void;

    Create .stack property on a target object

  • static isError(
    value: unknown
    ): value is Error;

    Check if a value is an instance of Error

    @param value

    The value to check

    @returns

    True if the value is an instance of Error, false otherwise

  • err: Error,
    stackTraces: CallSite[]
    ): any;