* --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)
| 268 | * @type {UnhandledRejectionsModeHandler} |
| 269 | */ |
| 270 | function 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: |
nothing calls this directly
no test coverage detected
searching dependent graphs…