mirror of
https://github.com/nodejs/node.git
synced 2025-05-04 16:26:26 +00:00

PR-URL: https://github.com/nodejs/node/pull/46384 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
28 lines
802 B
JavaScript
28 lines
802 B
JavaScript
'use strict';
|
|
// Flags: --force-node-api-uncaught-exceptions-policy
|
|
|
|
const common = require('../../common');
|
|
const assert = require('assert');
|
|
const binding = require(`./build/${common.buildType}/binding`);
|
|
|
|
const callbackCheck = common.mustCall((err) => {
|
|
assert.throws(() => { throw err; }, /callback error/);
|
|
process.removeListener('uncaughtException', callbackCheck);
|
|
process.on('uncaughtException', finalizerCheck);
|
|
});
|
|
const finalizerCheck = common.mustCall((err) => {
|
|
assert.throws(() => { throw err; }, /finalizer error/);
|
|
});
|
|
process.on('uncaughtException', callbackCheck);
|
|
|
|
binding.CallIntoModule(
|
|
common.mustCall(() => {
|
|
throw new Error('callback error');
|
|
}),
|
|
{},
|
|
'resource_name',
|
|
common.mustCall(function finalizer() {
|
|
throw new Error('finalizer error');
|
|
}),
|
|
);
|