Skip to content

Commit

Permalink
Merge pull request #307 from ethereumjs/break-on-programmatic-errors
Browse files Browse the repository at this point in the history
Throw original error and terminate execution on programmatic errors
  • Loading branch information
holgerd77 authored Jul 17, 2018
2 parents 4ecae8a + 9b1a0d0 commit 0e6d2ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const ERROR = {

function VmError (error) {
this.error = error
this.errorType = 'VmError'
}

module.exports = {
Expand Down
8 changes: 6 additions & 2 deletions lib/runCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,12 @@ module.exports = function (opts, cb) {
// run the opcode
var result = opFn.apply(null, args)
} catch (e) {
cb(e)
return
if (e.errorType && e.errorType === 'VmError') {
cb(e)
return
} else {
throw e
}
}

// save result to the stack
Expand Down

0 comments on commit 0e6d2ff

Please sign in to comment.