From 02546981c0bdaea313139665c2d8ca3eaf1e5dc5 Mon Sep 17 00:00:00 2001 From: Ayush Gupta Date: Sat, 28 Apr 2018 21:21:19 +0530 Subject: [PATCH] doc: document using `domain` in REPL Document that REPL uses the `domain` module to handle uncaught exceptions, and the side effects caused by it. PR-URL: https://github.com/nodejs/node/pull/20382 Fixes: https://github.com/nodejs/node/issues/19998 Reviewed-By: Vse Mozhet Byt Reviewed-By: Anna Henningsen Reviewed-By: Trivikram Kamat Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- doc/api/repl.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/api/repl.md b/doc/api/repl.md index b751472049a672..356d5ef47e206f 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -141,6 +141,17 @@ global or scoped variable, the input `fs` will be evaluated on-demand as > fs.createReadStream('./some/file'); ``` +#### Global Uncaught Exceptions + +The REPL uses the [`domain`][] module to catch all uncaught exceptions for that +REPL session. + +This use of the [`domain`][] module in the REPL has these side effects: + +* Uncaught exceptions do not emit the [`'uncaughtException'`][] event. +* Trying to use [`process.setUncaughtExceptionCaptureCallback()`][] throws + an [`ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE`][] error. + #### Assignment of the `_` (underscore) variable