1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

transactions - ensure err is defined when setting tx failed (#5801)

This commit is contained in:
Frankie 2018-11-26 09:00:58 -10:00 committed by GitHub
parent 3b1e73eff8
commit 97c1e6bcc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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')
}