GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: clarify repl exception conditions · nodejs/node@d340dca

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • repl.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/repl.md‎

Copy file name to clipboardExpand all lines: doc/api/repl.md
+11-20Lines changed: 11 additions & 20 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.