Skip to content

Commit 6f50f41

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 6f50f41

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ const path = require('path');
1414
const {
1515
codes: {
1616
ERR_EVAL_ESM_CANNOT_PRINT,
17-
ERR_INVALID_ARG_TYPE,
1817
ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET,
1918
},
2019
} = require('internal/errors');
20+
const { validateFunction } = require('internal/validators');
2121
const { pathToFileURL } = require('internal/url');
2222
const { exitCodes: { kGenericUserError } } = internalBinding('errors');
2323
const {
@@ -137,9 +137,7 @@ function setUncaughtExceptionCaptureCallback(fn) {
137137
// Auxiliary callbacks are called first; if any returns true, the error is handled.
138138
// Otherwise, the primary callback (if set) is called.
139139
function addUncaughtExceptionCaptureCallback(fn) {
140-
if (typeof fn !== 'function') {
141-
throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);
142-
}
140+
validateFunction(fn, 'fn');
143141
if (exceptionHandlerState.auxiliaryCallbacks.length === 0 &&
144142
exceptionHandlerState.captureFn === null) {
145143
exceptionHandlerState.reportFlag =

0 commit comments

Comments
 (0)