Skip to content

Commit

Permalink
Bubble up tx signing errors (web3#3105)
Browse files Browse the repository at this point in the history
* Bubble up tx signing errors

Resolves web3#2062
  • Loading branch information
gabmontes authored and nachomazzara committed Jun 4, 2020
1 parent 45707eb commit 1c8a4c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ Released with 1.0.0-beta.37 code base.
- Fix incorrectly populating chainId param with `net_version` when signing txs (#2378)
- regeneratorRuntime error fixed (#3058)
- Fix accessing event.name where event is undefined (#3014)
- Fix bubbling up tx signing errors (#2063, #3105)
- HttpProvider: CORS issue with Firefox and Safari (#2978)
11 changes: 10 additions & 1 deletion packages/web3-core-method/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,16 @@ Method.prototype.buildCall = function() {

// If wallet was found, sign tx, and send using sendRawTransaction
if (wallet && wallet.privateKey) {
return method.accounts.signTransaction(_.omit(tx, 'from'), wallet.privateKey).then(sendSignedTx);
return method.accounts.signTransaction(_.omit(tx, 'from'), wallet.privateKey)
.then(sendSignedTx)
.catch(function (err) {
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);
});
}

// ETH_SIGN
Expand Down

0 comments on commit 1c8a4c8

Please sign in to comment.