Skip to content

Commit

Permalink
Merge pull request #3709 from bloq/issue/3708
Browse files Browse the repository at this point in the history
Solve unhandled rejection if the error event handler of a transaction throws
  • Loading branch information
spacesailor24 committed Oct 19, 2020
2 parents 62cb124 + bb21562 commit 099fe36
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ Released with 1.0.0-beta.37 code base.
## [1.3.1]

### Changed

- bump utils 0.10.0^ -> 0.12.0 (#3733)

### Removed
Expand All @@ -299,5 +300,6 @@ Released with 1.0.0-beta.37 code base.

### Fixed

- Fix possible unhandled promise rejection when sending a transaction (#3708)
- Fixed decoding bytes and string parameters for logs emitted with solc 0.4.x (#3724, #3738)
- Grammar changes to inputAddressFormatter error message
9 changes: 7 additions & 2 deletions packages/web3-core-method/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,17 +725,22 @@ Method.prototype.buildCall = function () {
txOptions.common = method.defaultCommon;
}

return method.accounts.signTransaction(txOptions, wallet.privateKey)
method.accounts.signTransaction(txOptions, wallet.privateKey)
.then(sendSignedTx)
.catch(function (err) {
if (_.isFunction(defer.eventEmitter.listeners) && defer.eventEmitter.listeners('error').length) {
defer.eventEmitter.emit('error', err);
try {
defer.eventEmitter.emit('error', err);
} catch (err) {
// Ignore userland error prevent it to bubble up within web3.
}
defer.eventEmitter.removeAllListeners();
defer.eventEmitter.catch(function () {
});
}
defer.reject(err);
});
return;
}

// ETH_SIGN
Expand Down

0 comments on commit 099fe36

Please sign in to comment.