MCPcopy Index your code
hub / github.com/nodejs/node / setUncaughtExceptionCaptureCallback

Function setUncaughtExceptionCaptureCallback

lib/internal/process/execution.js:115–135  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

113};
114
115function setUncaughtExceptionCaptureCallback(fn) {
116 if (fn === null) {
117 exceptionHandlerState.captureFn = fn;
118 if (exceptionHandlerState.auxiliaryCallbacks.length === 0) {
119 shouldAbortOnUncaughtToggle[0] = 1;
120 process.report.reportOnUncaughtException = exceptionHandlerState.reportFlag;
121 }
122 return;
123 }
124 if (typeof fn !== 'function') {
125 throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'null'], fn);
126 }
127 if (exceptionHandlerState.captureFn !== null) {
128 throw new ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET();
129 }
130 exceptionHandlerState.captureFn = fn;
131 shouldAbortOnUncaughtToggle[0] = 0;
132 exceptionHandlerState.reportFlag =
133 process.report.reportOnUncaughtException === true;
134 process.report.reportOnUncaughtException = false;
135}
136
137// Add an auxiliary callback that coexists with the primary callback.
138// Auxiliary callbacks are called first; if any returns true, the error is handled.

Callers 2

updateExceptionCaptureFunction · 0.85
domain.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…