Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 099fe36

Browse files
Merge pull request #3709 from bloq/issue/3708
Solve unhandled rejection if the error event handler of a transaction throws
2 parents 62cb124 + bb21562 commit 099fe36

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ Released with 1.0.0-beta.37 code base.
291291
## [1.3.1]
292292

293293
### Changed
294+
294295
- bump utils 0.10.0^ -> 0.12.0 (#3733)
295296

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

300301
### Fixed
301302

303+
- Fix possible unhandled promise rejection when sending a transaction (#3708)
302304
- Fixed decoding bytes and string parameters for logs emitted with solc 0.4.x (#3724, #3738)
303305
- Grammar changes to inputAddressFormatter error message

packages/web3-core-method/src/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,17 +725,22 @@ Method.prototype.buildCall = function () {
725725
txOptions.common = method.defaultCommon;
726726
}
727727

728-
return method.accounts.signTransaction(txOptions, wallet.privateKey)
728+
method.accounts.signTransaction(txOptions, wallet.privateKey)
729729
.then(sendSignedTx)
730730
.catch(function (err) {
731731
if (_.isFunction(defer.eventEmitter.listeners) && defer.eventEmitter.listeners('error').length) {
732-
defer.eventEmitter.emit('error', err);
732+
try {
733+
defer.eventEmitter.emit('error', err);
734+
} catch (err) {
735+
// Ignore userland error prevent it to bubble up within web3.
736+
}
733737
defer.eventEmitter.removeAllListeners();
734738
defer.eventEmitter.catch(function () {
735739
});
736740
}
737741
defer.reject(err);
738742
});
743+
return;
739744
}
740745

741746
// ETH_SIGN

0 commit comments

Comments
 (0)