diff options
Diffstat (limited to 'app/scripts/controllers/transactions/tx-gas-utils.js')
-rw-r--r-- | app/scripts/controllers/transactions/tx-gas-utils.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/scripts/controllers/transactions/tx-gas-utils.js b/app/scripts/controllers/transactions/tx-gas-utils.js index def67c2c3..765551167 100644 --- a/app/scripts/controllers/transactions/tx-gas-utils.js +++ b/app/scripts/controllers/transactions/tx-gas-utils.js @@ -7,7 +7,7 @@ const { const { addHexPrefix } = require('ethereumjs-util') const SIMPLE_GAS_COST = '0x5208' // Hex for 21000, cost of a simple send. -import { TRANSACTION_NO_CONTRACT_ERROR_KEY } from '../../../../ui/app/constants/error-keys' +import { TRANSACTION_NO_CONTRACT_ERROR_KEY } from '../../../../ui/app/helpers/constants/error-keys' /** tx-gas-utils are gas utility methods for Transaction manager @@ -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 } |