Class EthersJsError

Custom error class for Ethers.js

Remarks

Ethers.js doesn't have a custom error class, which errs the error to be thrown as Error, that is hard to debug/show in the UI. So we create a custom error class to wrap the error with readable error message.

See

https://github.com/ethers-io/ethers.js/blob/01b5badbb616b29fd8b69ef7c3cc3833062da3d7/packages/logger/src.ts/index.ts#L197

Hierarchy (view full)

Constructors

Properties

cause?: unknown

Remarks

Below ES2022, Error has no cause. Adding it here as fallback so it is still accessible.

message: string
name: string
originalMessage: string
reason: string
stack?: string
MAKE_ERROR_CALLBACKS: (((e) => undefined | Error) | {
    makeError(e): undefined | Error;
})[] = []

List of error handlers to lookup.

Remarks

This list can be overridden to have a custom behavior. We recommend to only add new handler to this list.

USE_SIMPLE_MESSAGE: boolean = false
prepareStackTrace?: ((err, stackTraces) => any)

Optional override for formatting stack traces

Type declaration

stackTraceLimit: number

Methods

  • Returns string

    Remarks

    Should be overridden by subclasses

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

  • Parameters

    • err: Error
    • substring: string

    Returns boolean

Generated using TypeDoc