Skip to content

Commit 6125d23

Browse files
committed
fixup! repl: remove dependency on domain module
- Mark addUncaughtExceptionCaptureCallback as experimental - Add changes entry to setUncaughtExceptionCaptureCallback docs - Use validateFunction instead of manual type check
1 parent 045d98f commit 6125d23

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

doc/api/process.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ This feature is not available in [`Worker`][] threads.
742742
added: REPLACEME
743743
-->
744744

745+
> Stability: 1 - Experimental
746+
745747
* `fn` {Function}
746748

747749
The `process.addUncaughtExceptionCaptureCallback()` function adds a callback
@@ -4055,6 +4057,11 @@ This implies calling `module.setSourceMapsSupport()` with an option
40554057
40564058
<!-- YAML
40574059
added: v9.3.0
4060+
changes:
4061+
- version: REPLACEME
4062+
pr-url: https://github.com/nodejs/node/pull/61227
4063+
description: Use `process.addUncaughtExceptionCaptureCallback()` to
4064+
register multiple callbacks.
40584065
-->
40594066
40604067
* `fn` {Function|null}

lib/internal/process/execution.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const {
1818
ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET,
1919
},
2020
} = require('internal/errors');
21+
const { validateFunction } = require('internal/validators');
2122
const { pathToFileURL } = require('internal/url');
2223
const { exitCodes: { kGenericUserError } } = internalBinding('errors');
2324
const {
@@ -137,9 +138,7 @@ function setUncaughtExceptionCaptureCallback(fn) {
137138
// Auxiliary callbacks are called first; if any returns true, the error is handled.
138139
// Otherwise, the primary callback (if set) is called.
139140
function addUncaughtExceptionCaptureCallback(fn) {
140-
if (typeof fn !== 'function') {
141-
throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);
142-
}
141+
validateFunction(fn, 'fn');
143142
if (exceptionHandlerState.auxiliaryCallbacks.length === 0 &&
144143
exceptionHandlerState.captureFn === null) {
145144
exceptionHandlerState.reportFlag =

0 commit comments

Comments
 (0)