diff --git a/CHANGELOG.md b/CHANGELOG.md index 1396607178b..30f11a60cd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/packages/web3-core-method/src/index.js b/packages/web3-core-method/src/index.js index e8012bf77c6..efe8fd974a7 100644 --- a/packages/web3-core-method/src/index.js +++ b/packages/web3-core-method/src/index.js @@ -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