Skip to content

Commit 1c8a4c8

Browse files
gabmontesnachomazzara
authored andcommitted
Bubble up tx signing errors (web3#3105)
* Bubble up tx signing errors Resolves web3#2062
1 parent 45707eb commit 1c8a4c8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@ Released with 1.0.0-beta.37 code base.
6565
- Fix incorrectly populating chainId param with `net_version` when signing txs (#2378)
6666
- regeneratorRuntime error fixed (#3058)
6767
- Fix accessing event.name where event is undefined (#3014)
68+
- Fix bubbling up tx signing errors (#2063, #3105)
6869
- HttpProvider: CORS issue with Firefox and Safari (#2978)

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,16 @@ Method.prototype.buildCall = function() {
533533

534534
// If wallet was found, sign tx, and send using sendRawTransaction
535535
if (wallet && wallet.privateKey) {
536-
return method.accounts.signTransaction(_.omit(tx, 'from'), wallet.privateKey).then(sendSignedTx);
536+
return method.accounts.signTransaction(_.omit(tx, 'from'), wallet.privateKey)
537+
.then(sendSignedTx)
538+
.catch(function (err) {
539+
if (_.isFunction(defer.eventEmitter.listeners) && defer.eventEmitter.listeners('error').length) {
540+
defer.eventEmitter.emit('error', err);
541+
defer.eventEmitter.removeAllListeners();
542+
defer.eventEmitter.catch(function () {});
543+
}
544+
defer.reject(err);
545+
});
537546
}
538547

539548
// ETH_SIGN

0 commit comments

Comments
 (0)