Commit 75a4d125 authored by Alex Beregszaszi's avatar Alex Beregszaszi Committed by yann300

Fix VM exception handling after ethereumjs-vm update

parent 52f37734
...@@ -72,22 +72,23 @@ module.exports = { ...@@ -72,22 +72,23 @@ module.exports = {
if (!txResult.result.vm.exceptionError) { if (!txResult.result.vm.exceptionError) {
return ret 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 var msg
if (txResult.result.vm.exceptionError === errorCode.INVALID_OPCODE) { if (exceptionError === errorCode.INVALID_OPCODE) {
msg = `\t\n\tThe execution might have thrown.\n` msg = `\t\n\tThe execution might have thrown.\n`
ret.error = true 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` msg = `\tThe transaction ran out of gas. Please increase the Gas Limit.\n`
ret.error = true 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.` msg = `\tThe transaction has been reverted to the initial state.\nNote: The constructor should be payable if you send value.`
ret.error = true 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` msg = `\tState changes is not allowed in Static Call context\n`
ret.error = true 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 return ret
} }
} }
......
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