mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 03:07:54 +01:00
678551c294
If the exception is handled by the userland process#uncaughtException handler, reports should not be generated repetitively as the process may continue to run. PR-URL: https://github.com/nodejs/node/pull/44208 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
25 lines
757 B
JavaScript
25 lines
757 B
JavaScript
// 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());
|
|
// Do not install process uncaughtException handler.
|
|
|
|
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;
|