aboutsummaryrefslogtreecommitdiffstats
path: root/ethvm
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-24 18:12:00 +0800
committerobscuren <geffobscura@gmail.com>2014-07-24 18:12:00 +0800
commit3c3292d505b1c857f7fa28da0d37e3982ef5f8b5 (patch)
treeeb13b79b909e4ba688300ab2bf20639e332c90ec /ethvm
parent306b5bcff306bbdc5bc0b1590fca552f4fda41f6 (diff)
downloadgo-tangerine-3c3292d505b1c857f7fa28da0d37e3982ef5f8b5.tar.gz
go-tangerine-3c3292d505b1c857f7fa28da0d37e3982ef5f8b5.tar.zst
go-tangerine-3c3292d505b1c857f7fa28da0d37e3982ef5f8b5.zip
Added recoverable option
Diffstat (limited to 'ethvm')
-rw-r--r--ethvm/vm.go22
1 files changed, 13 insertions, 9 deletions
diff --git a/ethvm/vm.go b/ethvm/vm.go
index e159d8ff1..b81c8a189 100644
--- a/ethvm/vm.go
+++ b/ethvm/vm.go
@@ -37,6 +37,8 @@ type Vm struct {
BreakPoints []int64
Stepping bool
Fn string
+
+ Recoverable bool
}
type Environment interface {
@@ -62,18 +64,20 @@ func New(env Environment) *Vm {
lt = LogTyDiff
}
- return &Vm{env: env, logTy: lt}
+ return &Vm{env: env, logTy: lt, Recoverable: true}
}
func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
- // Recover from any require exception
- defer func() {
- if r := recover(); r != nil {
- ret = closure.Return(nil)
- err = fmt.Errorf("%v", r)
- vmlogger.Errorln("vm err", err)
- }
- }()
+ if self.Recoverable {
+ // Recover from any require exception
+ defer func() {
+ if r := recover(); r != nil {
+ ret = closure.Return(nil)
+ err = fmt.Errorf("%v", r)
+ vmlogger.Errorln("vm err", err)
+ }
+ }()
+ }
// Debug hook
if self.Dbg != nil {