Skip to content

Safe Wallet UI Failure Displays unhelpful error "Error: [object Object]" #6028

@Melvillian

Description

@Melvillian

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

  1. Go to sign a transaction (in this case I'm signing with a Ledger)
  2. 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 🤷 )
  3. 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

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions