-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: honor setUncaughtExceptionCaptureCallback
This api does not alter the behavior of diagnostic report configured on uncaught exceptions. This is deemed as a bug. Honor this API. Refs: #35588 PR-URL: #35595 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
- Loading branch information
1 parent
4079bfd
commit ddff2b2
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Flags: --report-uncaught-exception | ||
'use strict'; | ||
// Test report is suppressed on uncaught exception hook. | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const helper = require('../common/report'); | ||
const tmpdir = require('../common/tmpdir'); | ||
const error = new Error('test error'); | ||
|
||
tmpdir.refresh(); | ||
process.report.directory = tmpdir.path; | ||
|
||
// First, install an uncaught exception hook. | ||
process.setUncaughtExceptionCaptureCallback(common.mustCall()); | ||
|
||
// Make sure this is ignored due to the above override. | ||
process.on('uncaughtException', common.mustNotCall()); | ||
|
||
process.on('exit', (code) => { | ||
assert.strictEqual(code, 0); | ||
// Make sure no reports are generated. | ||
const reports = helper.findReports(process.pid, tmpdir.path); | ||
assert.strictEqual(reports.length, 0); | ||
}); | ||
|
||
throw error; |