We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I am trying to debug this issue Object has no memeber 'assign'
How can I get the stacktrace when there is an error in the javascript? I am using e.stack, but it's giving me an undefined value.
JS code: result.error = "Render Error: " + e + "\n\t\tStackTrace: " + e.stack + "."
result.error = "Render Error: " + e + "\n\t\tStackTrace: " + e.stack + "."
outcome: Render Error: TypeError: Object has no member 'assign' StackTrace: undefined.
Render Error: TypeError: Object has no member 'assign'
StackTrace: undefined.
The text was updated successfully, but these errors were encountered:
Currently the only way to get the stack trace is by converting the returned error into *goja.Exception and calling its String() method, e.g.:
func TestStacktrace(t *testing.T) { const SCRIPT = ` function f() { throw new Error("Test"); } f(); ` vm := New() _, err := vm.RunString(SCRIPT) if ex, ok := err.(*Exception); ok { t.Log(ex.String()) } }
This will print
Error: Test at f (<eval>:3:9(4)) at <eval>:6:3(7)
Error.stack property is not part of any specification, however it seems to be present in all major implementations, so I may add it in the future.
As for Object.assign, see #24
Sorry, something went wrong.
Thanks, I got the problem fixed.
No branches or pull requests
Hi,
I am trying to debug this issue Object has no memeber 'assign'
How can I get the stacktrace when there is an error in the javascript?
I am using e.stack, but it's giving me an undefined value.
JS code:
result.error = "Render Error: " + e + "\n\t\tStackTrace: " + e.stack + "."
outcome:
Render Error: TypeError: Object has no member 'assign'
StackTrace: undefined.
The text was updated successfully, but these errors were encountered: