Skip to content

Commit

Permalink
fix: wrap error messages correctly from walletconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronCQL committed Jul 3, 2024
1 parent 09ccce2 commit faa1e84
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/wallet/wallets/WalletError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit faa1e84

Please sign in to comment.