dydxprotocol / v4-web

Other
74 stars 61 forks source link

chore: better metamask error message [OTE-662] #936

Closed yogurtandjam closed 3 weeks ago

yogurtandjam commented 3 weeks ago

https://linear.app/dydx/issue/OTE-662/when-receiving-this-see-description-error-from-metamask-display-this

Override base error message from metamask error by:

Followup thoughts:

we should maybe in the future create a MetamaskErrorHandling function. Right now there's like 4-5 layers of indirection to get the error which is kind of a lot for something that could be relatively simply. This isn't because we are bad coders, it's because trying to reduce down an N number of errors from different sources with different formats is hard.

But with metamask errors, we know how they're shaped and what the error codes mean so we can pretty easily parse them all in a single function.

linear[bot] commented 3 weeks ago

OTE-662 When receiving this (see description) error from Metamask, display this in UI instead "Request already pending. Please complete in your wallet extension."

vercel[bot] commented 3 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
v4-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 21, 2024 4:22pm
v4-testnet 🛑 Canceled (Inspect) Aug 21, 2024 4:22pm
tinaszheng commented 3 weeks ago

we can probably just import the error types / codes from viem instead of making our own enum: https://github.com/wevm/wagmi/blob/27fc52c7398647af37d69ed7cac7cb2c90e0ad76/packages/core/src/connectors/injected.ts#L7