diff options
Diffstat (limited to 'vm/vm_debug.go')
-rw-r--r-- | vm/vm_debug.go | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/vm/vm_debug.go b/vm/vm_debug.go index 05ae347f6..b53949493 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -41,6 +41,21 @@ func NewDebugVm(env Environment) *DebugVm { func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) { self.depth++ + if self.Recoverable { + // Recover from any require exception + defer func() { + if r := recover(); r != nil { + self.Endl() + + ret = closure.Return(nil) + + err = fmt.Errorf("%v", r) + // No error should be set. Recover is used with require + // Is this too error prone? + } + }() + } + var ( op OpCode @@ -76,19 +91,6 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) { } ) - if self.Recoverable { - // Recover from any require exception - defer func() { - if r := recover(); r != nil { - self.Endl() - - ret = closure.Return(nil) - // No error should be set. Recover is used with require - // Is this too error prone? - } - }() - } - // Debug hook if self.Dbg != nil { self.Dbg.SetCode(closure.Code) |