diff options
author | kumavis <aaron@kumavis.me> | 2017-07-08 10:09:32 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2017-07-08 10:09:32 +0800 |
commit | c53aac398a29ff7cfe0efa6c844653693d78157b (patch) | |
tree | cffc0209cf921606478303d0bbfd9157c10f81cc | |
parent | 4fa999e4deae5451e73c126a80e541db6e3d0dc3 (diff) | |
download | tangerine-wallet-browser-c53aac398a29ff7cfe0efa6c844653693d78157b.tar.gz tangerine-wallet-browser-c53aac398a29ff7cfe0efa6c844653693d78157b.tar.zst tangerine-wallet-browser-c53aac398a29ff7cfe0efa6c844653693d78157b.zip |
tx controller - correctly set error message on resubmit error
-rw-r--r-- | app/scripts/controllers/transactions.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index bcce1bf8f..e1eaba232 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -417,14 +417,13 @@ module.exports = class TransactionController extends EventEmitter { // only try resubmitting if their are transactions to resubmit if (!pending.length) return const resubmit = denodeify(this._resubmitTx.bind(this)) - pending.forEach((txMeta) => resubmit(txMeta) - .catch((reason) => { + pending.forEach((txMeta) => resubmit(txMeta).catch((err) => { /* Dont marked as failed if the error is a "known" transaction warning "there is already a transaction with the same sender-nonce but higher/same gas price" */ - const errorMessage = reason.message.toLowerCase() + const errorMessage = err.message.toLowerCase() const isKnownTx = ( // geth errorMessage === 'replacement transaction underpriced' @@ -434,7 +433,12 @@ module.exports = class TransactionController extends EventEmitter { || errorMessage === 'transaction with the same hash was already imported.' ) // ignore resubmit warnings, return early - if (!isKnownTx) this.setTxStatusFailed(txMeta.id, reason.message) + if (isKnownTx) return + // encountered real error - transition to error state + this.setTxStatusFailed(txMeta.id, { + errCode: err.errCode || err, + message: err.message, + }) })) } |