Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d2dd473

Browse filesBrowse 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 <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>
1 parent 1bead0f commit d2dd473
Copy full SHA for d2dd473

File tree

Expand file treeCollapse file tree

1 file changed

+15
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/repl.md‎

Copy file name to clipboardExpand all lines: doc/api/repl.md
+15Lines changed: 15 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.