wevm / wagmi

Reactive primitives for Ethereum apps
https://wagmi.sh
MIT License
5.92k stars 1.02k forks source link

Can't catch error #4087

Closed AlansaladA closed 3 months ago

AlansaladA commented 3 months ago

Check existing issues

Describe the bug

When I call the approve method of the contract or operate to import tokens into the wallet(walletClient.data?.watchAsset), if I click reject in metamask, the user rejection cannot be captured in the catch and the execution continues. Also, when I want to switch to a chain that has not been added to the wallet, the console reports an error but it is not catched in the code.

But when I try to switch back to version 2.9.9, I can catch the error.

I have submitted an issue before, but it was closed because no reproduction was provided. Although I later replied with a link to the reproduction, it has not been processed, so I submitted it again

Link to Minimal Reproducible Example

https://github.com/AlansaladA/wagmi-catch-error-reproduction

Steps To Reproduce

No response

What Wagmi package(s) are you using?

wagmi

Wagmi Version

2.10.7

Viem Version

2.15.1

TypeScript Version

5.4.3

Anything else?

No response

tmm commented 3 months ago

This issue was introduced in @metamask/sdk@0.20.5 and will be fixed when https://github.com/MetaMask/metamask-sdk/pull/917/commits/e6d93b63067b7eda61f25ea267803290abbce8b7 is released. In the meantime, you can apply this patch or use the injected connector (which does not have this issue).

github-actions[bot] commented 2 months ago

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Wagmi version. If you have any questions or comments you can create a new discussion thread.