mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 05:53:11 +00:00

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>
29 lines
726 B
JavaScript
29 lines
726 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
(function foobar() {
|
|
require('domain');
|
|
})();
|
|
|
|
assert.throws(
|
|
() => process.setUncaughtExceptionCaptureCallback(common.mustNotCall()),
|
|
(err) => {
|
|
common.expectsError(
|
|
{
|
|
code: 'ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE',
|
|
type: Error,
|
|
message: /^The `domain` module is in use, which is mutually/
|
|
}
|
|
)(err);
|
|
|
|
assert(err.stack.includes('-'.repeat(40)),
|
|
`expected ${err.stack} to contain dashes`);
|
|
|
|
const location = `at foobar (${__filename}:`;
|
|
assert(err.stack.includes(location),
|
|
`expected ${err.stack} to contain ${location}`);
|
|
return true;
|
|
}
|
|
);
|