mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Have better error messages
This commit is contained in:
parent
046774e768
commit
8c7be43403
@ -172,7 +172,10 @@ module.exports = class TransactionManager extends EventEmitter {
|
|||||||
], (err) => {
|
], (err) => {
|
||||||
self.nonceLock.leave()
|
self.nonceLock.leave()
|
||||||
if (err) {
|
if (err) {
|
||||||
this.setTxStatusFailed(txId)
|
this.setTxStatusFailed(txId, {
|
||||||
|
errCode: err.errCode || err,
|
||||||
|
message: err.message || 'Transaction failed during approval',
|
||||||
|
})
|
||||||
return cb(err)
|
return cb(err)
|
||||||
}
|
}
|
||||||
cb()
|
cb()
|
||||||
@ -291,7 +294,10 @@ module.exports = class TransactionManager extends EventEmitter {
|
|||||||
this._setTxStatus(txId, 'confirmed')
|
this._setTxStatus(txId, 'confirmed')
|
||||||
}
|
}
|
||||||
|
|
||||||
setTxStatusFailed (txId) {
|
setTxStatusFailed (txId, reason) {
|
||||||
|
let txMeta = this.getTx(txId)
|
||||||
|
txMeta.err = reason
|
||||||
|
this.updateTx(txMeta)
|
||||||
this._setTxStatus(txId, 'failed')
|
this._setTxStatus(txId, 'failed')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,12 +318,11 @@ module.exports = class TransactionManager extends EventEmitter {
|
|||||||
var txHash = txMeta.hash
|
var txHash = txMeta.hash
|
||||||
var txId = txMeta.id
|
var txId = txMeta.id
|
||||||
if (!txHash) {
|
if (!txHash) {
|
||||||
txMeta.err = {
|
let errReason = {
|
||||||
errCode: 'No hash was provided',
|
errCode: 'No hash was provided',
|
||||||
message: 'We had an error while submitting this transaction, please try again.',
|
message: 'We had an error while submitting this transaction, please try again.',
|
||||||
}
|
}
|
||||||
this.updateTx(txMeta)
|
return this.setTxStatusFailed(txId, errReason)
|
||||||
return this.setTxStatusFailed(txId)
|
|
||||||
}
|
}
|
||||||
this.txProviderUtils.query.getTransactionByHash(txHash, (err, txParams) => {
|
this.txProviderUtils.query.getTransactionByHash(txHash, (err, txParams) => {
|
||||||
if (err || !txParams) {
|
if (err || !txParams) {
|
||||||
|
Loading…
Reference in New Issue
Block a user