-
Notifications
You must be signed in to change notification settings - Fork 573
Open
Description
Bug description
When I try to sign a safe wallet transaction in the UI and it fails, the error message it displays is unhelpful. It looks like this:
An internal error was received.
Details: Keyring Controller signTypedMessage: Error: [object Object]
Version: viem@2.21.55
Environment
- Browser: Brave
- Wallet: MetaMask
- Chain: Ethereum sepolia
Steps to reproduce
- Go to sign a transaction (in this case I'm signing with a Ledger)
- Sign in a way that has the transaction fail (I don't know why mine is failing, but I guess try to sign without your ledger plugged in 🤷 )
- Get the error to pop up
Expected result
I expect the error to include a useful error message, like "wallet not detected" or something
Obtained result
I get javascript's default way of printing out an object (very likely a JSON object) which looks like [object Object]
Suggested Solution
In your error handling code, you need to do JSON.stringify(errorMessage, null, 2)
, because the way it's working now is your error handling code gets passed an object and when it goes to convert it to a string, it loses all of the important error message information and just leaves [object Object]
.
Screenshots
Metadata
Metadata
Assignees
Labels
No labels