summaryrefslogtreecommitdiff
path: root/test/parallel/test-process-exception-capture-errors.js
blob: d2f5b8617725f434fe0b0e039754d31c6a626964 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'use strict';
const common = require('../common');

common.expectsError(
  () => process.setUncaughtExceptionCaptureCallback(42),
  {
    code: 'ERR_INVALID_ARG_TYPE',
    type: TypeError,
    message: 'The "fn" argument must be one of type Function or null. ' +
             'Received type number'
  }
);

process.setUncaughtExceptionCaptureCallback(common.mustNotCall());

common.expectsError(
  () => process.setUncaughtExceptionCaptureCallback(common.mustNotCall()),
  {
    code: 'ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET',
    type: Error,
    message: /setupUncaughtExceptionCapture.*called while a capture callback/
  }
);