diff options
author | Frankie <frankie.diamond@gmail.com> | 2018-11-27 03:00:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-27 03:00:58 +0800 |
commit | 97c1e6bcc145e60d6721ecba50d762791f94dc13 (patch) | |
tree | 70b36bd48bcdfdbabd5e1f088fd0be216e4a7998 | |
parent | 3b1e73eff8bc553877cee957a401aa502f64a1b6 (diff) | |
download | tangerine-wallet-browser-97c1e6bcc145e60d6721ecba50d762791f94dc13.tar.gz tangerine-wallet-browser-97c1e6bcc145e60d6721ecba50d762791f94dc13.tar.zst tangerine-wallet-browser-97c1e6bcc145e60d6721ecba50d762791f94dc13.zip |
transactions - ensure err is defined when setting tx failed (#5801)
-rw-r--r-- | app/scripts/controllers/transactions/tx-state-manager.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/app/scripts/controllers/transactions/tx-state-manager.js b/app/scripts/controllers/transactions/tx-state-manager.js index 151082452..72d869fa8 100644 --- a/app/scripts/controllers/transactions/tx-state-manager.js +++ b/app/scripts/controllers/transactions/tx-state-manager.js @@ -361,13 +361,15 @@ class TransactionStateManager extends EventEmitter { @param err {erroObject} - error object */ setTxStatusFailed (txId, err) { + const error = !err ? new Error('Internal metamask failure') : err + const txMeta = this.getTx(txId) txMeta.err = { - message: err.toString(), - rpc: err.value, - stack: err.stack, + message: error.toString(), + rpc: error.value, + stack: error.stack, } - this.updateTx(txMeta) + this.updateTx(txMeta, 'transactions:tx-state-manager#fail - add error') this._setTxStatus(txId, 'failed') } |