Browse Source

Pass unhandled panic straight through. Do not dump the code. Closes #95, closes #112.

Dmitry Panov 6 năm trước cách đây
mục cha
commit
bb8ee191fd
1 tập tin đã thay đổi với 8 bổ sung6 xóa
  1. 8 6
      vm.go

+ 8 - 6
vm.go

@@ -2,7 +2,6 @@ package goja
 
 import (
 	"fmt"
-	"log"
 	"math"
 	"runtime"
 	"strconv"
@@ -364,11 +363,14 @@ func (vm *vm) try(f func()) (ex *Exception) {
 			case *Exception:
 				ex = x1
 			default:
-				if vm.prg != nil {
-					vm.prg.dumpCode(log.Printf)
-				}
-				//log.Print("Stack: ", string(debug.Stack()))
-				panic(fmt.Errorf("Panic at %d: %v", vm.pc, x))
+				/*
+					if vm.prg != nil {
+						vm.prg.dumpCode(log.Printf)
+					}
+					log.Print("Stack: ", string(debug.Stack()))
+					panic(fmt.Errorf("Panic at %d: %v", vm.pc, x))
+				*/
+				panic(x)
 			}
 			ex.stack = vm.captureStack(ex.stack, ctxOffset)
 		}