1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

transactions/tx-gas-utils - add the acctual response for eth_getCode for NO_CONTRACT_ERROR's && add a debug object to simulationFailed (#5840)

This commit is contained in:
Frankie 2018-11-29 08:07:05 -10:00 committed by Dan Finlay
parent 67d9f445bd
commit a803522a92

View File

@ -35,7 +35,13 @@ class TxGasUtil {
txMeta.simulationFails = {
reason: err.message,
errorKey: err.errorKey,
debug: { blockNumber: block.number, blockGasLimit: block.gasLimit },
}
if (err.errorKey === TRANSACTION_NO_CONTRACT_ERROR_KEY) {
txMeta.simulationFails.debug.getCodeResponse = err.getCodeResponse
}
return txMeta
}
this.setTxGas(txMeta, block.gasLimit, estimatedGasHex)
@ -74,6 +80,9 @@ class TxGasUtil {
const err = new Error('TxGasUtil - Trying to call a function on a non-contract address')
// set error key so ui can display localized error message
err.errorKey = TRANSACTION_NO_CONTRACT_ERROR_KEY
// set the response on the error so that we can see in logs what the actual response was
err.getCodeResponse = code
throw err
}