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

NativeError does not support fileName and lineNumber; catching Java exceptions does not work #32

Open
rjb3977 opened this issue Sep 11, 2022 · 0 comments
Assignees
Labels
bug Something isn't working priority: medium This issue or PR should be worked on soon-ish

Comments

@rjb3977
Copy link

rjb3977 commented Sep 11, 2022

NativeError contains "constructor", "toString", and "toSource" in its prototype, but neither "fileName" nor "lineNumber". This causes a problem because NativeError::make sets those properties if the respective arguments are passed. This can be reproduced with:

new SyntaxError("", "");

This also causes actual problems when trying to catch exceptions thrown in Java code, because ScriptRuntime::newCatchScope provides fileName and lineNumber. This can be reproduced with:

try {
    Integer.parseInt("");
} catch(e) {
    console.log("caught error");
}

I found this using KubeJS on 1.19 with Rhino 1802.1.14-build.225. I tried using 1802.2.0-build.232, but it doesn't seem there's a KubeJS release for 1.19 that supports that version.

@MaxNeedsSnacks MaxNeedsSnacks added bug Something isn't working priority: medium This issue or PR should be worked on soon-ish labels Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: medium This issue or PR should be worked on soon-ish
Projects
None yet
Development

No branches or pull requests

3 participants