-
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
Solve unhandled rejection if the error event handler of a transaction throws #3709
Conversation
a1975ab
to
ead64c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested the replication steps mentioned in #3708, and these changes seems to allow the actual Web3 error to be returned to the user (instead of the unhandled promise rejection error)
@gabmontes do you mind updating the changelog |
@gabmontes any update please |
042482f
@GregTheGreek I just rebased the commits on top of ´1.x´ to eliminate the merge conflict. Thanks for pinging me again. Just missed your original message. |
Thanks for the quick turn around :) |
Rebased again due to another CHANGELOG conflict. |
@gabmontes If you can fix the CHANGELOG, we should be able to merge this ASAP |
Since the event handlers are run syncronously, if an `error` event handler thows, the error will return to the lib and keep the promise chain broken, rising an unhandled promise rejection error. Resolves web3#3708
The inner function sendRequest that belongs to Method.buildCall should not return anything. Returning a promise might lead to some dev reading the code to think that any promise rejection would be handled in the caller. But the fact is that all the calls to it (below) just discard anything returned. So better to clean this up.
bb21562
@spacesailor24 solved again. Moved this issue's line in the change log to the top of the fixes so we don't have more conflicts (🤞). |
Description
Since the event handlers are run synchronously, if an
error
event handler throws in userland, the error will return to the lib and keep thesendRequest
promise chain broken, rising an unhandled promise rejection error. See #3708 for a detailed explanation of the error and how to reproduce.Fixes #3708
Type of change
Checklist:
npm run dtslint
with success and extended the tests and types if necessary.npm run test:unit
with success.npm run test:cov
and my test cases cover all the lines and branches of the added code.npm run build
and testeddist/web3.min.js
in a browser.CHANGELOG.md
file in the root folder.