Skip to content
New issue

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

Make JS_ToCString return legible result for InternalErrors #273

Closed
bnoordhuis opened this issue Feb 18, 2024 · 0 comments · Fixed by #274
Closed

Make JS_ToCString return legible result for InternalErrors #273

bnoordhuis opened this issue Feb 18, 2024 · 0 comments · Fixed by #274
Labels
enhancement New feature or request

Comments

@bnoordhuis
Copy link
Contributor

Sometimes, calling JS_ToCString(ctx, val) where val is an instance of InternalError returns an empty string. Not very helpful when the exception object does in fact have a .message property with a human-readable error message.

Probably happens when there is a pending exception. Deep down, quickjs tries to invoke the [Symbol.toPrimitive] method but I doubt that works while an exception is pending.

Let's make debugging a little less miserable and special-case exception objects.

@bnoordhuis bnoordhuis added the enhancement New feature or request label Feb 18, 2024
bnoordhuis added a commit to bnoordhuis/quickjs that referenced this issue Feb 18, 2024
`ToString(object)` can fail when there is a pending exception. Add a
special case for exception objects to help debugging. Getting an empty
string when the real error was "InternalError: stack overflow" is rage
inducing.

Fixes: quickjs-ng#273
bnoordhuis added a commit to bnoordhuis/quickjs that referenced this issue Feb 18, 2024
`ToString(object)` can fail when there is a pending exception. Add a
special case for exception objects to help debugging. Getting an empty
string when the real error was "InternalError: stack overflow" is rage
inducing.

Fixes: quickjs-ng#273
bnoordhuis added a commit that referenced this issue Feb 19, 2024
`ToString(object)` can fail when there is a pending exception. Add a
special case for exception objects to help debugging. Getting an empty
string when the real error was "InternalError: stack overflow" is rage
inducing.

Fixes: #273
ramiropolla pushed a commit to ramiropolla/ffglitch-core that referenced this issue Dec 10, 2024
`ToString(object)` can fail when there is a pending exception. Add a
special case for exception objects to help debugging. Getting an empty
string when the real error was "InternalError: stack overflow" is rage
inducing.

Fixes: quickjs-ng/quickjs#273
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant