mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
tx controller - correctly set error message on resubmit error
This commit is contained in:
parent
4fa999e4de
commit
c53aac398a
@ -417,14 +417,13 @@ module.exports = class TransactionController extends EventEmitter {
|
|||||||
// only try resubmitting if their are transactions to resubmit
|
// only try resubmitting if their are transactions to resubmit
|
||||||
if (!pending.length) return
|
if (!pending.length) return
|
||||||
const resubmit = denodeify(this._resubmitTx.bind(this))
|
const resubmit = denodeify(this._resubmitTx.bind(this))
|
||||||
pending.forEach((txMeta) => resubmit(txMeta)
|
pending.forEach((txMeta) => resubmit(txMeta).catch((err) => {
|
||||||
.catch((reason) => {
|
|
||||||
/*
|
/*
|
||||||
Dont marked as failed if the error is a "known" transaction warning
|
Dont marked as failed if the error is a "known" transaction warning
|
||||||
"there is already a transaction with the same sender-nonce
|
"there is already a transaction with the same sender-nonce
|
||||||
but higher/same gas price"
|
but higher/same gas price"
|
||||||
*/
|
*/
|
||||||
const errorMessage = reason.message.toLowerCase()
|
const errorMessage = err.message.toLowerCase()
|
||||||
const isKnownTx = (
|
const isKnownTx = (
|
||||||
// geth
|
// geth
|
||||||
errorMessage === 'replacement transaction underpriced'
|
errorMessage === 'replacement transaction underpriced'
|
||||||
@ -434,7 +433,12 @@ module.exports = class TransactionController extends EventEmitter {
|
|||||||
|| errorMessage === 'transaction with the same hash was already imported.'
|
|| errorMessage === 'transaction with the same hash was already imported.'
|
||||||
)
|
)
|
||||||
// ignore resubmit warnings, return early
|
// ignore resubmit warnings, return early
|
||||||
if (!isKnownTx) this.setTxStatusFailed(txMeta.id, reason.message)
|
if (isKnownTx) return
|
||||||
|
// encountered real error - transition to error state
|
||||||
|
this.setTxStatusFailed(txMeta.id, {
|
||||||
|
errCode: err.errCode || err,
|
||||||
|
message: err.message,
|
||||||
|
})
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user