mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
4503da8a3a
Introduce `process.shouldAbortOnUncaughtException` to control `--abort-on-uncaught-exception` behaviour, and implement some of the domains functionality on top of it. PR-URL: https://github.com/nodejs/node/pull/17159 Refs: https://github.com/nodejs/node/issues/17143 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
14 lines
473 B
JavaScript
14 lines
473 B
JavaScript
// Flags: --abort-on-uncaught-exception
|
|
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
assert.strictEqual(process.hasUncaughtExceptionCaptureCallback(), false);
|
|
|
|
// This should make the process not crash even though the flag was passed.
|
|
process.setUncaughtExceptionCaptureCallback(common.mustCall((err) => {
|
|
assert.strictEqual(err.message, 'foo');
|
|
}));
|
|
process.on('uncaughtException', common.mustNotCall());
|
|
throw new Error('foo');
|