| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b1da374 commit 144233b
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -340,7 +340,7 @@ function strictUnhandledRejectionsMode(promise, promiseInfo, promiseAsyncId) { | |||
| 340 | 340 | reason : new UnhandledPromiseRejection(reason); | |
| 341 | 341 | // This destroys the async stack, don't clear it after | |
| 342 | 342 | triggerUncaughtException(err, true /* fromPromise */); | |
| 343 | - if (promiseAsyncId === undefined) { | ||
| 343 | + if (promiseAsyncId !== undefined) { | ||
| 344 | 344 | pushAsyncContext( | |
| 345 | 345 | promise[kAsyncIdSymbol], | |
| 346 | 346 | promise[kTriggerAsyncIdSymbol], | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,29 @@ | |||
| 1 | + // Flags: --unhandled-rejections=strict | ||
| 2 | + 'use strict'; | ||
| 3 | + | ||
| 4 | + const common = require('../common'); | ||
| 5 | + const fs = require('fs'); | ||
| 6 | + const assert = require('assert'); | ||
| 7 | + | ||
| 8 | + process.on('unhandledRejection', common.mustNotCall); | ||
| 9 | + | ||
| 10 | + process.on('uncaughtException', common.mustCall((err) => { | ||
| 11 | + assert.ok(err.message.includes('foo')); | ||
| 12 | + })); | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + async function readFile() { | ||
| 16 | + return fs.promises.readFile(__filename); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + async function crash() { | ||
| 20 | + throw new Error('foo'); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + async function main() { | ||
| 25 | + crash(); | ||
| 26 | + readFile(); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + main(); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments