Skip to content

API ReferenceErrorsClass

ConfigError

Error thrown when the SDK’s setup cannot support the requested operation. For example: AnvilSDK was constructed without a profile, a read needs a subgraph URL that neither subgraphUrl nor the profile provides, or the connected wallet is on a different chain than the profile or the transaction expects. The message names what disagrees and how to fix it.

Extends

Constructors

Constructor

new ConfigError(message, cause?): ConfigError;

Parameters

ParameterType
messagestring
cause?unknown

Returns

ConfigError

Overrides

BaseError.constructor

Methods

walk()

walk<T>(errorType): T | undefined;

Finds an error of the given class in this error’s cause chain. The search starts with this error itself, then follows each cause in turn.

Type Parameters

Type ParameterDescription
T extends ErrorThe error class being searched for.

Parameters

ParameterTypeDescription
errorType(…args) => TThe error class to find, such as UserRejectedRequestError.

Returns

T | undefined

The first error in the chain that is an instance of errorType, or undefined if there is none.

Example

const rejected = error.walk(UserRejectedRequestError);
if (rejected) return; // the user declined in their wallet

Inherited from

BaseError.walk