feat(extension): get exception stacks on promise error (#630)

This commit is contained in:
Levi authored and GitHub committed 2024-08-07 12:04:45 +08:00
1 parent d119de7b98
commit 3fd3dd49d2
5 files changed
+45 -17

No files matched your search

+9 -1
View File
@@ -178,7 +178,15 @@ func resolveResult(value goja.Value) (any, error) {
if err, ok := p.Result().Export().(error); ok {
return nil, err
} else {
return nil, errors.New(p.Result().String())
stack := p.Result().String()
result := p.Result()
if ro, ok := result.(*goja.Object); ok {
stackVal := ro.Get("stack")
if stackVal != nil && stackVal.String() != "" {
stack = stackVal.String()
}
}
return nil, errors.New(stack)
}
}
}