diff --git a/src/wallet/wallets/WalletError.ts b/src/wallet/wallets/WalletError.ts index bada7cf5..8cf1bfe4 100644 --- a/src/wallet/wallets/WalletError.ts +++ b/src/wallet/wallets/WalletError.ts @@ -27,8 +27,11 @@ export class WalletError extends Error { if (typeof err === "string") { throw new WalletError(err, err); } - if (err instanceof Error) { - throw new WalletError(err.message, err); + if ( + err instanceof Error || + (typeof err === "object" && err != null && "message" in err) + ) { + throw new WalletError((err as Record<"message", string>).message, err); } throw new WalletError("unknown error", err); }