[#6102] fixed JSVM exception -> Go error unwrapping

This commit is contained in:
Gani Georgiev
2024-12-13 17:54:43 +02:00
parent 4f35fb74c8
commit 3098c2dcd8
33 changed files with 119 additions and 60 deletions

View File

@@ -326,21 +326,7 @@ func (p *plugin) normalizeServeExceptions(e *core.RequestEvent) error {
return err // no error or already committed
}
jsException, ok := err.(*goja.Exception)
if !ok {
return err // no exception
}
switch v := jsException.Value().Export().(type) {
case error:
err = v
case map[string]any: // goja.GoError
if vErr, ok := v["value"].(error); ok {
err = vErr
}
}
return err
return normalizeException(err)
}
// watchHooks initializes a hooks file watcher that will restart the