Closed yogurtandjam closed 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 |
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
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:
getWalletErrorType
functiongetErrorMessageForCode
which defaults to the given error message and use that for the error message catchallFollowup 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.