diff --git a/js/common/util.go b/js/common/util.go index d1d01e06b0e..90b95e7cadd 100644 --- a/js/common/util.go +++ b/js/common/util.go @@ -65,21 +65,15 @@ func ToString(data interface{}) (string, error) { } // RunWithPanicCatching catches panic and converts into an InterruptError error that should abort a script -func RunWithPanicCatching(logger logrus.FieldLogger, rt *goja.Runtime, fn func() error) (err error) { +func RunWithPanicCatching(logger logrus.FieldLogger, _ *goja.Runtime, fn func() error) (err error) { defer func() { if r := recover(); r != nil { - gojaStack := rt.CaptureCallStack(20, nil) - err = &errext.InterruptError{Reason: fmt.Sprintf("a panic occurred during JS execution: %s", r)} // TODO figure out how to use PanicLevel without panicing .. this might require changing // the logger we use see // https://github.com/sirupsen/logrus/issues/1028 // https://github.com/sirupsen/logrus/issues/993 - b := new(bytes.Buffer) - for _, s := range gojaStack { - s.Write(b) - } - logger.Error("panic: ", r, "\n", string(debug.Stack()), "\nGoja stack:\n", b.String()) + logger.Error("panic: ", r, "\n", string(debug.Stack())) } }()