-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Node REPL does not honor uncaughtException
listeners
#19998
Comments
uncaughtException
listenersuncaughtException
listeners
This is happening because the We could maybe be a bit more forward and explicitly disable |
@addaleax That's what I thought to, but instead of disabling In either case, we do need to document this. |
I'll open a PR this Monday to document this behaviour, unless someone beats me to it or we decide to change something. |
@addaleax before I start on documenting this, 1 question: what're your thoughts on replacing the error handling via |
@AyushG3112 My thoughts are that that’s probably very hard to get that to work, because in general there can be multiple REPL instances in a process, which need to keep track of async context in order to determine whether they should handle an exception |
Document that REPL uses the `domain` module to handle uncaught exceptions, and the side effects caused by it. Fixes: nodejs#19998
Document that REPL uses the `domain` module to handle uncaught exceptions, and the side effects caused by it. PR-URL: #20382 Fixes: #19998 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Document that REPL uses the `domain` module to handle uncaught exceptions, and the side effects caused by it. PR-URL: #20382 Fixes: #19998 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Document that REPL uses the `domain` module to handle uncaught exceptions, and the side effects caused by it. PR-URL: #20382 Fixes: #19998 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Reopened, since I have a fix for this. See #27151 |
When running the REPL as standalone program it's now possible to use `process.on('uncaughtException', listener)`. It is going to use those listeners from now on and the regular error output is suppressed. It also fixes the issue that REPL instances started inside of an application would silence all application errors. It is now prohibited to add the exception listener in such REPL instances. Trying to add such listeners throws an `ERR_INVALID_REPL_INPUT` error. Fixes: nodejs#19998
Reopened due to a revert due to test failures. |
When running the REPL as standalone program it's now possible to use `process.on('uncaughtException', listener)`. It is going to use those listeners from now on and the regular error output is suppressed. It also fixes the issue that REPL instances started inside of an application would silence all application errors. It is now prohibited to add the exception listener in such REPL instances. Trying to add such listeners throws an `ERR_INVALID_REPL_INPUT` error. Fixes: #19998 PR-URL: #27151 Fixes: #19998 Reviewed-By: Lance Ball <[email protected]> Reviewed-By: Rich Trott <[email protected]>
REPL commands
OUTPUT :
Thrown: hi
Running
process.hasUncaughtExceptionCaptureCallback()
in the REPL console outputstrue
, so it is understandable why the listener isn't called.However
> process.setUncaughtExceptionCaptureCallback(null);
throws the Error:
I could not find any documentation of this behaviour for the Node REPL.
Is this a bug, or is this a desired behaviour which has to be documented?
The text was updated successfully, but these errors were encountered: