File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -163,30 +163,21 @@ This use of the [`domain`][] module in the REPL has these side effects:
163163
164164* Uncaught exceptions only emit the [ ` 'uncaughtException' ` ] [ ] event in the
165165 standalone REPL. Adding a listener for this event in a REPL within
166- another Node.js program throws [ ` ERR_INVALID_REPL_INPUT ` ] [ ] .
167- * Trying to use [ ` process.setUncaughtExceptionCaptureCallback() ` ] [ ] throws
168- an [ ` ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE ` ] [ ] error.
169-
170- As standalone program:
171-
172- ``` js
173- process .on (' uncaughtException' , () => console .log (' Uncaught' ));
166+ another Node.js program results in [ ` ERR_INVALID_REPL_INPUT ` ] [ ] .
174167
175- throw new Error (' foobar' );
176- // Uncaught
177- ```
168+ ``` js
169+ const r = repl .start ();
178170
179- When used in another application:
171+ r .write (' process.on("uncaughtException", () => console.log("Foobar"));\n ' );
172+ // Output stream includes:
173+ // TypeError [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException`
174+ // cannot be used in the REPL
180175
181- ``` js
182- process .on (' uncaughtException' , () => console .log (' Uncaught' ));
183- // TypeError [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException`
184- // cannot be used in the REPL
176+ r .close ();
177+ ```
185178
186- throw new Error (' foobar' );
187- // Thrown:
188- // Error: foobar
189- ```
179+ * Trying to use [ ` process.setUncaughtExceptionCaptureCallback() ` ] [ ] throws
180+ an [ ` ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE ` ] [ ] error.
190181
191182#### Assignment of the ` _ ` (underscore) variable
192183<!-- YAML
You can’t perform that action at this time.
0 commit comments