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

Function strictUnhandledRejectionsMode

lib/internal/process/promises.js:270–286  ·  view source on GitHub ↗

* --unhandled-rejections=strict: * Emit 'uncaughtException'. If it's not handled, print the error to stderr * and exit the process. * Otherwise, emit 'unhandledRejection'. If 'unhandledRejection' is not * handled, emit 'UnhandledPromiseRejectionWarning'. * @type {UnhandledRejectionsModeHandler}

(promise, promiseInfo, promiseAsyncId)

Source from the content-addressed store, hash-verified

268 * @type {UnhandledRejectionsModeHandler}
269 */
270function strictUnhandledRejectionsMode(promise, promiseInfo, promiseAsyncId) {
271 const reason = promiseInfo.reason;
272 const err = isErrorLike(reason) ?
273 reason : new UnhandledPromiseRejection(reason);
274 // This destroys the async stack, don't clear it after
275 triggerUncaughtException(err, true /* fromPromise */);
276 if (promiseAsyncId !== undefined) {
277 pushAsyncContext(
278 promise[kAsyncIdSymbol],
279 promise[kTriggerAsyncIdSymbol],
280 promise,
281 );
282 }
283 const handled = emitUnhandledRejection(promise, promiseInfo);
284 if (!handled) emitUnhandledRejectionWarning(promiseInfo);
285 return true;
286}
287
288/**
289 * --unhandled-rejections=none:

Callers

nothing calls this directly

Calls 4

pushAsyncContextFunction · 0.85
emitUnhandledRejectionFunction · 0.85
isErrorLikeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…