From b0d6991d960584d7b7e699693a4c979259211c11 Mon Sep 17 00:00:00 2001
From: RedYetiDev <38299977+RedYetiDev@users.noreply.github.com>
Date: Sat, 5 Oct 2024 17:35:22 -0400
Subject: [PATCH] repl: don't use deprecated `domain` module
---
doc/api/errors.md | 14 +-
doc/api/repl.md | 38 -----
lib/internal/errors.js | 1 -
lib/repl.js | 143 +++++++++++-------
.../repl-tab-completion-nested-repls.js | 4 +-
test/parallel/test-repl-domain.js | 45 ------
test/parallel/test-repl-save-load.js | 4 +-
.../parallel/test-repl-tab-complete-import.js | 2 +-
test/parallel/test-repl-tab-complete.js | 2 +-
test/parallel/test-repl-tab.js | 2 +-
.../test-repl-uncaught-exception-async.js | 44 ------
test/parallel/test-repl-uncaught-exception.js | 113 +++++++-------
test/parallel/test-repl-underscore.js | 6 +-
13 files changed, 158 insertions(+), 260 deletions(-)
delete mode 100644 test/parallel/test-repl-domain.js
delete mode 100644 test/parallel/test-repl-uncaught-exception-async.js
diff --git a/doc/api/errors.md b/doc/api/errors.md
index 7d076312a726d9..803dd226cfac26 100644
--- a/doc/api/errors.md
+++ b/doc/api/errors.md
@@ -2016,13 +2016,6 @@ An invalid `options.protocol` was passed to `http.request()`.
Both `breakEvalOnSigint` and `eval` options were set in the [`REPL`][] config,
which is not supported.
-
-
-### `ERR_INVALID_REPL_INPUT`
-
-The input may not be used in the [`REPL`][]. The conditions under which this
-error is used are described in the [`REPL`][] documentation.
-
### `ERR_INVALID_RETURN_PROPERTY`
@@ -3538,6 +3531,13 @@ removed: v16.7.0
While using the Performance Timing API (`perf_hooks`), a performance mark is
invalid.
+
+
+### `ERR_INVALID_REPL_INPUT`
+
+The input may not be used in the [`REPL`][]. The conditions under which this
+error is used are described in the [`REPL`][] documentation.
+
### `ERR_INVALID_TRANSFER_OBJECT`
diff --git a/doc/api/repl.md b/doc/api/repl.md
index 8d00cdeed3916a..4e4978c4997197 100644
--- a/doc/api/repl.md
+++ b/doc/api/repl.md
@@ -147,39 +147,6 @@ 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 only emit the [`'uncaughtException'`][] event in the
- standalone REPL. Adding a listener for this event in a REPL within
- another Node.js program results in [`ERR_INVALID_REPL_INPUT`][].
-
- ```js
- const r = repl.start();
-
- r.write('process.on("uncaughtException", () => console.log("Foobar"));\n');
- // Output stream includes:
- // TypeError [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException`
- // cannot be used in the REPL
-
- r.close();
- ```
-
-* Trying to use [`process.setUncaughtExceptionCaptureCallback()`][] throws
- an [`ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE`][] error.
-
#### Assignment of the `_` (underscore) variable