From 75a4d125fec2dd25734c9a7e91743b943c0f7c08 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 13 Apr 2018 01:52:33 +0100 Subject: [PATCH] Fix VM exception handling after ethereumjs-vm update --- remix-lib/src/execution/txExecution.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/remix-lib/src/execution/txExecution.js b/remix-lib/src/execution/txExecution.js index c80c09d192..135eb0380c 100644 --- a/remix-lib/src/execution/txExecution.js +++ b/remix-lib/src/execution/txExecution.js @@ -72,22 +72,23 @@ module.exports = { if (!txResult.result.vm.exceptionError) { return ret } - var error = `VM error: ${txResult.result.vm.exceptionError}.\n` + var exceptionError = txResult.result.vm.exceptionError.error || '' + var error = `VM error: ${exceptionError}.\n` var msg - if (txResult.result.vm.exceptionError === errorCode.INVALID_OPCODE) { + if (exceptionError === errorCode.INVALID_OPCODE) { msg = `\t\n\tThe execution might have thrown.\n` ret.error = true - } else if (txResult.result.vm.exceptionError === errorCode.OUT_OF_GAS) { + } else if (exceptionError === errorCode.OUT_OF_GAS) { msg = `\tThe transaction ran out of gas. Please increase the Gas Limit.\n` ret.error = true - } else if (txResult.result.vm.exceptionError === errorCode.REVERT) { + } else if (exceptionError === errorCode.REVERT) { msg = `\tThe transaction has been reverted to the initial state.\nNote: The constructor should be payable if you send value.` ret.error = true - } else if (txResult.result.vm.exceptionError === errorCode.STATIC_STATE_CHANGE) { + } else if (exceptionError === errorCode.STATIC_STATE_CHANGE) { msg = `\tState changes is not allowed in Static Call context\n` ret.error = true } - ret.message = `${error}${txResult.result.vm.exceptionError}${msg}\tDebug the transaction to get more information.` + ret.message = `${error}${exceptionError}${msg}\tDebug the transaction to get more information.` return ret } }