File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -742,6 +742,8 @@ This feature is not available in [`Worker`][] threads.
742742added: REPLACEME
743743-->
744744
745+ > Stability: 1 - Experimental
746+
745747* ` fn ` {Function}
746748
747749The ` process.addUncaughtExceptionCaptureCallback() ` function adds a callback
@@ -4055,6 +4057,11 @@ This implies calling `module.setSourceMapsSupport()` with an option
40554057
40564058<!-- YAML
40574059added: 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}
Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ const path = require('path');
1414const {
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' ) ;
2121const { pathToFileURL } = require ( 'internal/url' ) ;
2222const { exitCodes : { kGenericUserError } } = internalBinding ( 'errors' ) ;
2323const {
@@ -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.
139139function 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 =
You can’t perform that action at this time.
0 commit comments