diff options
author | kumavis <kumavis@users.noreply.github.com> | 2017-03-23 00:55:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-23 00:55:47 +0800 |
commit | 864f8b06f9f2ec56b7ffce0afe83a1d70c3c7843 (patch) | |
tree | b1ac48a2b9ae051dc6db0fad3cbdcec653ea85b0 /app | |
parent | 046774e76877f8f833445c76e2013d7f2c9bfff3 (diff) | |
parent | 2ffd42f9f06e1b89b49c12f8ded1c12ecb249c57 (diff) | |
download | tangerine-wallet-browser-864f8b06f9f2ec56b7ffce0afe83a1d70c3c7843.tar tangerine-wallet-browser-864f8b06f9f2ec56b7ffce0afe83a1d70c3c7843.tar.gz tangerine-wallet-browser-864f8b06f9f2ec56b7ffce0afe83a1d70c3c7843.tar.bz2 tangerine-wallet-browser-864f8b06f9f2ec56b7ffce0afe83a1d70c3c7843.tar.lz tangerine-wallet-browser-864f8b06f9f2ec56b7ffce0afe83a1d70c3c7843.tar.xz tangerine-wallet-browser-864f8b06f9f2ec56b7ffce0afe83a1d70c3c7843.tar.zst tangerine-wallet-browser-864f8b06f9f2ec56b7ffce0afe83a1d70c3c7843.zip |
Merge pull request #1239 from MetaMask/betterErrors
Better errors
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/transaction-manager.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/app/scripts/transaction-manager.js b/app/scripts/transaction-manager.js index c6cfdf11d..31c1c8431 100644 --- a/app/scripts/transaction-manager.js +++ b/app/scripts/transaction-manager.js @@ -172,7 +172,10 @@ module.exports = class TransactionManager extends EventEmitter { ], (err) => { self.nonceLock.leave() if (err) { - this.setTxStatusFailed(txId) + this.setTxStatusFailed(txId, { + errCode: err.errCode || err, + message: err.message || 'Transaction failed during approval', + }) return cb(err) } cb() @@ -291,7 +294,10 @@ module.exports = class TransactionManager extends EventEmitter { this._setTxStatus(txId, 'confirmed') } - setTxStatusFailed (txId) { + setTxStatusFailed (txId, reason) { + let txMeta = this.getTx(txId) + txMeta.err = reason + this.updateTx(txMeta) this._setTxStatus(txId, 'failed') } @@ -312,12 +318,11 @@ module.exports = class TransactionManager extends EventEmitter { var txHash = txMeta.hash var txId = txMeta.id if (!txHash) { - txMeta.err = { + let errReason = { errCode: 'No hash was provided', message: 'We had an error while submitting this transaction, please try again.', } - this.updateTx(txMeta) - return this.setTxStatusFailed(txId) + return this.setTxStatusFailed(txId, errReason) } this.txProviderUtils.query.getTransactionByHash(txHash, (err, txParams) => { if (err || !txParams) { |