-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Jsonrpc errors get burried inside error.message string #15250
Comments
@worldlyjohn was thinking about something similar so we also get more digested error messages on Mixpanel and can more easily work on addressing the underlying issues. |
im open to 1, 1b, 2, 5 |
2 seems ideal. Will move forward with that |
The problem statement here seems to be that these errors are too difficult to read, but that might be the wrong problem. Most of these errors should never reach the dapp API in the first place. I'm less concerned that our internal errors are readable than I am in reducing the number of internal errors we have. We should not have internal errors. Contract errors, network errors, input validation, etc. should be explicitly handled by us and exposed as the appropriate JSON-RPC/Ethereum provider error, with a nice readable error message. These are situations we can anticipate and handle. |
## **Description** Our fork of ethjs-query has been namespaced to the `@metamask/` namespace, and updated with mostly development only fixes. There is one exception which is the reason for this pull request which is the removal of a try/catch that was catching too broadly and wrapping legitimate errors in a new Error object that claimed the issue was with the formatting of the output. In most cases this is incorrect and results in a wide swath of errors being lumped together inside of sentry. This change will result in the real errors being surfaced, after which we can decide where to prioritize efforts to resolve RPC issues. This PR progresses, and is expected to change the stack trace for the following issues: #9317 #10519 #10619 #11488 #11974 #13395 #14298 #14365 #15250 #17073 #17803 #19697 #20699 We are closing these issues opened automatically by sentry-io which are not fully resolved but should result in better errors and stack traces: fixes #10552 fixes #14660 fixes #14676 fixes #14730 fixes #14801 fixes #15065 ## **Manual testing steps** 1. Attempt to reproduce any of the bugs listed, 17073 was the easiest to reproduce for me. This involves getting test currency from the wemix faucet as listed in the issue and initiating a transaction between two accounts you own. 2. On develop you'll see an 'error formatting outputs' error text similar to what is reported in the issue. 3. On this branch you'll get the original error, without the wrapped 'formatting' error. including a different stack trace. ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained: - [x] What problem this PR is solving. - [x] How this problem was solved. - [x] How reviewers can test my changes. - [x] I’ve indicated what issue this PR is linked to: Fixes #??? - [x] I’ve included tests if applicable. - [x] I’ve documented any added code. - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). - [x] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
#22875) ## **Description** ## **Related issues** - #27784 - MetaMask/eth-json-rpc-middleware#335 - #27917 - #18510 - #15250 - MetaMask/metamask-improvement-proposals#36 ### Blocked by - [x] #24496 ### Follow-up to - #24496 ## **Manual testing steps** ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [x] I've linked related issues - [x] I've included manual testing steps - [x] I've included screenshots/recordings if applicable - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [x] I’ve properly set the pull request status: - [x] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
#22875) ## **Description** ## **Related issues** - #27784 - MetaMask/eth-json-rpc-middleware#335 - #27917 - #18510 - #15250 - MetaMask/metamask-improvement-proposals#36 ### Blocked by - [x] #24496 ### Follow-up to - #24496 ## **Manual testing steps** ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [x] I've linked related issues - [x] I've included manual testing steps - [x] I've included screenshots/recordings if applicable - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [x] I’ve properly set the pull request status: - [x] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
#22875) - #27784 - MetaMask/eth-json-rpc-middleware#335 - #27917 - #18510 - #15250 - MetaMask/metamask-improvement-proposals#36 - [x] #24496 - #24496 - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [x] I've linked related issues - [x] I've included manual testing steps - [x] I've included screenshots/recordings if applicable - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [x] I’ve properly set the pull request status: - [x] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
Describe the bug
Problem
Errors returned from ethereum JSON-RPC api providers, when not expected by ethjs-query, are in a hard to use format.
Using localhost, or using addEthereumNetwork means we have no control over the responses, and thus should hold minimal expectation over their results / errors. While this issue is most prevelant among users who are connecting to ganache or hardhat, you can also get this error by setting too low of gas while using an infura provider.
Examples
The useful parts of the error messages are inside of a string, and doubly nested.
Possible Solutions
1.b Same as 1, except leave error.message as is (to not break things), and parse the string out same way as in the PR, but put the result insdie of error.data.
result.value
, and handle unrecognized errors better by not stringifying the error.Proposed way forward
Steps to reproduce
(this is just one way to make it happen, but it happens on infura endpoints when making contract calls with a gas setting thats too low)
to
addressThe text was updated successfully, but these errors were encountered: