Commit d36fe1ce authored by yann300's avatar yann300

fix checkVMError params

parent 55e0e7ca
...@@ -57,7 +57,7 @@ export function callFunction (from, to, data, value, gasLimit, funAbi, txRunner, ...@@ -57,7 +57,7 @@ export function callFunction (from, to, data, value, gasLimit, funAbi, txRunner,
* @param {Object} execResult - execution result given by the VM * @param {Object} execResult - execution result given by the VM
* @return {Object} - { error: true/false, message: DOMNode } * @return {Object} - { error: true/false, message: DOMNode }
*/ */
export function checkVMError (txResult, abi) { export function checkVMError (execResult, abi) {
const errorCode = { const errorCode = {
OUT_OF_GAS: 'out of gas', OUT_OF_GAS: 'out of gas',
STACK_UNDERFLOW: 'stack underflow', STACK_UNDERFLOW: 'stack underflow',
...@@ -75,10 +75,10 @@ export function checkVMError (txResult, abi) { ...@@ -75,10 +75,10 @@ export function checkVMError (txResult, abi) {
error: false, error: false,
message: '' message: ''
} }
if (!txResult.result.execResult.exceptionError) { if (!execResult.exceptionError) {
return ret return ret
} }
const exceptionError = txResult.result.execResult.exceptionError.error || '' const exceptionError = execResult.exceptionError.error || ''
const error = `VM error: ${exceptionError}.\n` const error = `VM error: ${exceptionError}.\n`
let msg let msg
if (exceptionError === errorCode.INVALID_OPCODE) { if (exceptionError === errorCode.INVALID_OPCODE) {
...@@ -88,7 +88,7 @@ export function checkVMError (txResult, abi) { ...@@ -88,7 +88,7 @@ export function checkVMError (txResult, abi) {
msg = '\tThe transaction ran out of gas. Please increase the Gas Limit.\n' msg = '\tThe transaction ran out of gas. Please increase the Gas Limit.\n'
ret.error = true ret.error = true
} else if (exceptionError === errorCode.REVERT) { } else if (exceptionError === errorCode.REVERT) {
const returnData = txResult.result.execResult.returnValue const returnData = execResult.returnValue
const returnDataHex = returnData.slice(0, 4).toString('hex') const returnDataHex = returnData.slice(0, 4).toString('hex')
let customError let customError
if (abi) { if (abi) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment