2017-11-20 19:57:20 +01:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
2019-12-25 18:02:16 +01:00
|
|
|
const assert = require('assert');
|
2017-11-20 19:57:20 +01:00
|
|
|
|
2019-12-25 18:02:16 +01:00
|
|
|
assert.throws(
|
2017-11-20 19:57:20 +01:00
|
|
|
() => process.setUncaughtExceptionCaptureCallback(42),
|
|
|
|
{
|
|
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
2019-12-25 18:02:16 +01:00
|
|
|
name: 'TypeError',
|
2019-09-23 08:17:25 +02:00
|
|
|
message: 'The "fn" argument must be of type function or null. ' +
|
|
|
|
'Received type number (42)'
|
2017-11-20 19:57:20 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
process.setUncaughtExceptionCaptureCallback(common.mustNotCall());
|
|
|
|
|
2019-12-25 18:02:16 +01:00
|
|
|
assert.throws(
|
2017-11-20 19:57:20 +01:00
|
|
|
() => process.setUncaughtExceptionCaptureCallback(common.mustNotCall()),
|
|
|
|
{
|
|
|
|
code: 'ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET',
|
2019-12-25 18:02:16 +01:00
|
|
|
name: 'Error',
|
2017-11-20 19:57:20 +01:00
|
|
|
message: /setupUncaughtExceptionCapture.*called while a capture callback/
|
|
|
|
}
|
|
|
|
);
|