Skip to content

Commit

Permalink
Avoid rejecting a promise if listening on error
Browse files Browse the repository at this point in the history
  • Loading branch information
gabmontes committed Nov 23, 2018
1 parent 0da83f7 commit ca76f76
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/web3-core-method/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,10 @@ Method.prototype.buildCall = function() {
return method.accounts.signTransaction(_.omit(tx, 'from'), wallet.privateKey)
.then(sendSignedTx)
.catch(function (err) {
if (defer.eventEmitter.emit) {
if (_.isFunction(defer.eventEmitter.listeners) && defer.eventEmitter.listeners('error').length) {
defer.eventEmitter.emit('error', err);
defer.eventEmitter.removeAllListeners();
defer.eventEmitter.catch(function () {});
}
defer.reject(err);
});
Expand Down

0 comments on commit ca76f76

Please sign in to comment.