mirror of
https://github.com/nodejs/node.git
synced 2025-05-04 08:28:40 +00:00

This enables the option `--force-node-api-uncaught-exceptions-policy` for a specific Node-API addon when it is compiled with `NAPI_EXPERIMENTAL` (and this would be the default behavior when `NAPI_VERSION` 10 releases). This would not break existing Node-API addons. PR-URL: https://github.com/nodejs/node/pull/49313 Refs: https://github.com/nodejs/node/pull/36510 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Gabriel Schulhof <gabrielschulhof@gmail.com>
21 lines
550 B
JavaScript
21 lines
550 B
JavaScript
'use strict';
|
|
// Flags: --expose-gc --force-node-api-uncaught-exceptions-policy
|
|
|
|
const common = require('../../common');
|
|
const binding = require(`./build/${common.buildType}/test_finalizer`);
|
|
const assert = require('assert');
|
|
|
|
process.on('uncaughtException', common.mustCall((err) => {
|
|
assert.throws(() => { throw err; }, /finalizer error/);
|
|
}));
|
|
|
|
(async function() {
|
|
{
|
|
binding.createExternalWithJsFinalize(
|
|
common.mustCall(() => {
|
|
throw new Error('finalizer error');
|
|
}));
|
|
}
|
|
global.gc();
|
|
})().then(common.mustCall());
|