-
Notifications
You must be signed in to change notification settings - Fork 16
fix: make sure we don't panic when an exception is thrown in an async context #135
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
base: main
Are you sure you want to change the base?
Conversation
To be clear, normal exception were already being handled properly |
Tried to make the exception more helpful by using
|
something i noticed looking at this example, is that it runs correctly when I make the main function async: export async function main() { this leads me to believe that the error is actually related to calling async code in a non-async function or something lower level than the actual exception being raised. the i think we need to investigate this a little more, since async definitely does work, but there is still something weird going on. |
Fixes #134
What's going on?
In this code sample:
highlighter
is not awaited, so it's still a Promise socodeToHtml
doesn't exist.And it seems like quickjs can't deal with promise rejections well:
I have made sure we handle this case, and we let the user know async is not supported in Extism functions (see issue_134 example):