Skip to content

Commit

Permalink
transactions - ensure err is defined when setting tx failed (#5801)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiebee authored Nov 26, 2018
1 parent 3b1e73e commit 97c1e6b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/scripts/controllers/transactions/tx-state-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}

Expand Down

0 comments on commit 97c1e6b

Please sign in to comment.