Skip to content

Commit d2dd473

Browse files
AyushG3112MylesBorins
authored andcommitted
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: #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]>
1 parent 1bead0f commit d2dd473

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

doc/api/repl.md

+15
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@ global or scoped variable, the input `fs` will be evaluated on-demand as
141141
> fs.createReadStream('./some/file');
142142
```
143143

144+
#### Global Uncaught Exceptions
145+
146+
The REPL uses the [`domain`][] module to catch all uncaught exceptions for that
147+
REPL session.
148+
149+
This use of the [`domain`][] module in the REPL has these side effects:
150+
151+
* Uncaught exceptions do not emit the [`'uncaughtException'`][] event.
152+
* Trying to use [`process.setUncaughtExceptionCaptureCallback()`][] throws
153+
an [`ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE`][] error.
154+
144155
#### Assignment of the `_` (underscore) variable
145156
<!-- YAML
146157
changes:
@@ -613,7 +624,11 @@ a `net.Server` and `net.Socket` instance, see:
613624
For an example of running a REPL instance over [curl(1)][], see:
614625
[https://gist.github.com/2053342](https://gist.github.com/2053342).
615626

627+
[`'uncaughtException'`]: process.html#process_event_uncaughtexception
616628
[`--experimental-repl-await`]: cli.html#cli_experimental_repl_await
629+
[`ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE`]: errors.html#errors_err_domain_cannot_set_uncaught_exception_capture
630+
[`domain`]: domain.html
631+
[`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn
617632
[`readline.InterfaceCompleter`]: readline.html#readline_use_of_the_completer_function
618633
[`readline.Interface`]: readline.html#readline_class_interface
619634
[`util.inspect()`]: util.html#util_util_inspect_object_options

0 commit comments

Comments
 (0)