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

Try catch syntax does not work correctly when using native syntax #263

Closed
ayahito-saji opened this issue Feb 26, 2024 · 2 comments
Closed

Comments

@ayahito-saji
Copy link

Hi, I am using JS-interpreter and have observed that the try-catch syntax does not work correctly and stops with an error in the following case.

try {
  new Date(NaN).toISOString();
} catch (e) {
  alert("caught");
}

I am guessing the cause is that this program is using the native toISOString() and the error occurs outside of the interpreter (native). These errors need to be propagated inside the interpreter, or to be raised internally.

@ayahito-saji
Copy link
Author

NeilFraser added a commit that referenced this issue Feb 27, 2024
Resolves issue #263
Recompile.
@NeilFraser
Copy link
Owner

Thanks for this report. Fixed. I've tested the rest of the Date instance methods, this appears to be the only one that can throw, the rest return either NaN or "Invalid Date".

This class of bug is still lurking in other places. I'll fix them one by one as they are found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants