From 99f112d3808a60bfe514b94bc06277525b634802 Mon Sep 17 00:00:00 2001 From: Ayush Gupta Date: Sat, 28 Apr 2018 21:21:19 +0530 Subject: [PATCH] doc: document that repl uses `domain` module for error handling Document that REPL uses the `domain` module to handle uncaught exceptions, and the side effects caused by it. Fixes: https://github.com/nodejs/node/issues/19998 --- doc/api/repl.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/api/repl.md b/doc/api/repl.md index b751472049a672..331f1f6849baf9 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