Class ErrorWithContext

An Error base-class that also provides some additional context.

All first-party error handlers in Extollo can render the context as part of the display of the error (e.g. in the console, in the HTML response, &c.)

Example

function myFunc(arg1, arg2) {
// ...do something...
throw new ErrorWithContext('Something went wrong!', { arg1, arg2 })
}

Hierarchy

Constructors

Properties

cause?: unknown
context: {
    [key: string]: any;
} = {}

Type declaration

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

Type declaration

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void