mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
doc: document REPL DEP0185 throws and uncaught-exception behavior
Two doc-only improvements to `doc/api/repl.md`, both filling gaps left by recent semver-major REPL changes: 1. `repl.REPLServer` is an ES class; calling it without `new` is End-of-Life (DEP0185) and throws a native V8 `TypeError`. The "Class: REPLServer" section now notes this and links to the DEP0185 entry in `doc/api/deprecations.md`. No `Stability: 0` banner is added because the class itself is not deprecated — only the `new`-less invocation is — matching the parallel DEP0184/DEP0195 "classes without `new`" convention. 2. PR #64034 ("repl: use inspector over vm") removed the old "Global uncaught exceptions" subsection because the `domain`-based restrictions it documented no longer exist. A new top-level `### Error handling` section documents the current model (mirroring the `### Error handling` convention in async_hooks/http2/quic), anchored to the existing `Uncaught Error: REPL await` example. Refs: https://github.com/nodejs/node/pull/59495 Refs: https://github.com/nodejs/node/pull/54869 Refs: https://github.com/nodejs/node/pull/54842 Refs: https://github.com/nodejs/node/pull/64034 Signed-off-by: Adrian Estrada <edsadr@gmail.com> PR-URL: https://github.com/nodejs/node/pull/64993 Reviewed-By: Erick Wendel <erick.workspace@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
1 parent
5902acf031
commit
fe9f452ddd
1 file changed
+13
@@ -276,6 +276,15 @@ Uncaught SyntaxError: Identifier 'm' has already been declared
|
||||
|
||||
[`--no-experimental-repl-await`][] shall disable top-level await in REPL.
|
||||
|
||||
### Error handling
|
||||
|
||||
By default, uncaught exceptions in the REPL are printed to the output stream
|
||||
(as with `Uncaught Error: REPL await` above). `uncaughtException` listeners
|
||||
can be added freely in both standalone and nested REPLs. The `handleError`
|
||||
option of [`repl.start()`][] can customize this behavior, including
|
||||
forwarding exceptions to [`'uncaughtException'`][] by returning
|
||||
`'unhandled'`.
|
||||
|
||||
### Reverse-i-search
|
||||
|
||||
<!-- YAML
|
||||
@@ -469,6 +478,9 @@ const firstInstance = repl.start(options);
|
||||
const secondInstance = new repl.REPLServer(options);
|
||||
```
|
||||
|
||||
Calling `repl.REPLServer()` without the `new` keyword throws a `TypeError`
|
||||
(see [DEP0185][]).
|
||||
|
||||
### Event: `'exit'`
|
||||
|
||||
<!-- YAML
|
||||
@@ -1170,6 +1182,7 @@ avoiding open network interfaces.
|
||||
|
||||
Original code from <https://gist.github.com/TooTallNate/2053342>.
|
||||
|
||||
[DEP0185]: deprecations.md#dep0185-instantiating-noderepl-classes-without-new
|
||||
[TTY keybindings]: readline.md#tty-keybindings
|
||||
[ZSH]: https://en.wikipedia.org/wiki/Z_shell
|
||||
[`'uncaughtException'`]: process.md#event-uncaughtexception
|
||||
|
||||
Reference in new issue
Block a user