Skip to content

Commit

Permalink
doc: document that repl uses domain module for error handling
Browse files Browse the repository at this point in the history
Document that REPL uses the `domain` module to handle uncaught
exceptions, and the side effects caused by it.

Fixes: nodejs#19998
  • Loading branch information
AyushG3112 committed May 4, 2018
1 parent 2d609c5 commit 99f112d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions doc/api/repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -618,4 +629,9 @@ For an example of running a REPL instance over [curl(1)][], see:
[`readline.Interface`]: readline.html#readline_class_interface
[`util.inspect()`]: util.html#util_util_inspect_object_options
[curl(1)]: https://curl.haxx.se/docs/manpage.html
[`domain`]: domain.html
[`'uncaughtException'`]: process.html#process_event_uncaughtexception
[`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn
[`ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE`]: errors.html#errors_err_domain_cannot_set_uncaught_exception_capture
[stream]: stream.html

0 comments on commit 99f112d

Please sign in to comment.