Skip to content

API ReferenceErrorsClass

WalletNotConnectedError

Error thrown when an operation needs a connected wallet account and none is available: no wallet client is configured, it has no account, or the wallet disconnected or was replaced while the operation was running. Prompt the user to connect their wallet, then try again.

Inside a WalletOperationWorkflow it does not throw: the step is marked Failed with validationErrorResponse { root: ['WalletNotConnected'] }.

Extends

Extended by

Constructors

Constructor

new WalletNotConnectedError(message, cause?): WalletNotConnectedError;

Parameters

ParameterType
messagestring
cause?unknown

Returns

WalletNotConnectedError

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