-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Engine error #345
Comments
Any API with blocking, Java can't stop the engine from reporting errors. |
This is a Node.js feature that you missed. Basically, application is supposed to listen the event Please review the following test code. nodeRuntime.getExecutor("let a = [];\n" +
"process.on('uncaughtException', (error, origin) => {\n" +
" a.push(origin, error);\n" +
"});").executeVoid();
nodeRuntime.getExecutor("setTimeout(() => { throw new Error('Error'); }, 0);").executeVoid();
nodeRuntime.await();
assertEquals("uncaughtException", nodeRuntime.getExecutor("a[0]").executeString());
try (V8ValueError v8ValueError = nodeRuntime.getExecutor("a[1]").execute()) {
assertEquals("Error", v8ValueError.getMessage());
} |
Sorry so much, this is my problem, I'm using unhandledRejection instead of uncaughtException, much appreciated! |
And I replied that the reason why 3.1.2 can't start is because of setResourceName, if the Node.js engine uses this api, the engine won't execute. |
@caoccao Is it possible to make the exception catchable in Java? So the program can to things correspondingly like close resources, cancel jobs etc. And perhaps just to prevent it crash the system entirely. For example in this scenario: nodeRuntime.getExecutor(script).setModule(true).executeVoid() I figured it is |
Errors in APIs such as setTimeout and setnterval cannot be caught, and errors will be thrown directly.
Error
The text was updated successfully, but these errors were encountered: