|
@@ -1370,6 +1370,15 @@ func AssertFunction(v Value) (Callable, bool) {
|
|
if obj, ok := v.(*Object); ok {
|
|
if obj, ok := v.(*Object); ok {
|
|
if f, ok := obj.self.assertCallable(); ok {
|
|
if f, ok := obj.self.assertCallable(); ok {
|
|
return func(this Value, args ...Value) (ret Value, err error) {
|
|
return func(this Value, args ...Value) (ret Value, err error) {
|
|
|
|
+ defer func() {
|
|
|
|
+ if x := recover(); x != nil {
|
|
|
|
+ if ex, ok := x.(*InterruptedError); ok {
|
|
|
|
+ err = ex
|
|
|
|
+ } else {
|
|
|
|
+ panic(x)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }()
|
|
ex := obj.runtime.vm.try(func() {
|
|
ex := obj.runtime.vm.try(func() {
|
|
ret = f(FunctionCall{
|
|
ret = f(FunctionCall{
|
|
This: this,
|
|
This: this,
|
|
@@ -1414,6 +1423,8 @@ func tryFunc(f func()) (err error) {
|
|
switch x := x.(type) {
|
|
switch x := x.(type) {
|
|
case *Exception:
|
|
case *Exception:
|
|
err = x
|
|
err = x
|
|
|
|
+ case *InterruptedError:
|
|
|
|
+ err = x
|
|
case Value:
|
|
case Value:
|
|
err = &Exception{
|
|
err = &Exception{
|
|
val: x,
|
|
val: x,
|