From e68441a86b0f27357dfe6215c0873ec4cd7029b0 Mon Sep 17 00:00:00 2001 From: cdle Date: Thu, 6 Jul 2023 10:41:00 +0800 Subject: [PATCH] x --- core/plugin_utils.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/plugin_utils.go b/core/plugin_utils.go index 664e5f2..f21afec 100644 --- a/core/plugin_utils.go +++ b/core/plugin_utils.go @@ -351,6 +351,17 @@ func SetPluginMethod(vm *goja.Runtime, uuid string, on_start bool, running func( vm.Set("fetch", func(wts ...interface{}) interface{} { promise, resolve, reject := vm.NewPromise() go func() { + defer func() { + err := recover() + if err != nil { + o, ok := err.(*goja.Object) + if ok { + (&Console{ + UUID: uuid, + }).Error(o.Get("value")) + } + } + }() obj, err := fetch(vm, uuid, wts...) if err != nil { reject(err)