• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2// Flags: --force-node-api-uncaught-exceptions-policy
3
4const common = require('../../common');
5const assert = require('assert');
6const binding = require(`./build/${common.buildType}/binding`);
7
8const callbackCheck = common.mustCall((err) => {
9  assert.throws(() => { throw err; }, /callback error/);
10  process.removeListener('uncaughtException', callbackCheck);
11  process.on('uncaughtException', finalizerCheck);
12});
13const finalizerCheck = common.mustCall((err) => {
14  assert.throws(() => { throw err; }, /finalizer error/);
15});
16process.on('uncaughtException', callbackCheck);
17
18binding.CallIntoModule(
19  common.mustCall(() => {
20    throw new Error('callback error');
21  }),
22  {},
23  'resource_name',
24  common.mustCall(function finalizer() {
25    throw new Error('finalizer error');
26  }),
27);
28