• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const assert = require('assert');
4
5assert.throws(
6  () => process.setUncaughtExceptionCaptureCallback(42),
7  {
8    code: 'ERR_INVALID_ARG_TYPE',
9    name: 'TypeError',
10    message: 'The "fn" argument must be of type function or null. ' +
11             'Received type number (42)'
12  }
13);
14
15process.setUncaughtExceptionCaptureCallback(common.mustNotCall());
16
17assert.throws(
18  () => process.setUncaughtExceptionCaptureCallback(common.mustNotCall()),
19  {
20    code: 'ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET',
21    name: 'Error',
22    message: /setupUncaughtExceptionCapture.*called while a capture callback/
23  }
24);
25