summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAyush Gupta <AyushG3112@gmail.com>2018-04-28 21:21:19 +0530
committerVse Mozhet Byt <vsemozhetbyt@gmail.com>2018-05-04 23:05:56 +0300
commit1cf7ef6433d773f15e324a9f284fe8b674d0d90c (patch)
tree9abe4bdb79a47ca89b3fd367163c374c9e801cfe /doc
parent2d609c5d53a4394bd2a9c6e15ab074c3cc2039a2 (diff)
downloadandroid-node-v8-1cf7ef6433d773f15e324a9f284fe8b674d0d90c.tar.gz
android-node-v8-1cf7ef6433d773f15e324a9f284fe8b674d0d90c.tar.bz2
android-node-v8-1cf7ef6433d773f15e324a9f284fe8b674d0d90c.zip
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 <vsemozhetbyt@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/repl.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/api/repl.md b/doc/api/repl.md
index b751472049..356d5ef47e 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
<!-- YAML
changes:
@@ -613,7 +624,11 @@ a `net.Server` and `net.Socket` instance, see:
For an example of running a REPL instance over [curl(1)][], see:
[https://gist.github.com/2053342](https://gist.github.com/2053342).
+[`'uncaughtException'`]: process.html#process_event_uncaughtexception
[`--experimental-repl-await`]: cli.html#cli_experimental_repl_await
+[`ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE`]: errors.html#errors_err_domain_cannot_set_uncaught_exception_capture
+[`domain`]: domain.html
+[`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn
[`readline.InterfaceCompleter`]: readline.html#readline_use_of_the_completer_function
[`readline.Interface`]: readline.html#readline_class_interface
[`util.inspect()`]: util.html#util_util_inspect_object_options