blob: f22273e01c9db8de70fce39b5ec46dfffda7d05a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
'use strict';
const common = require('../common');
const assert = require('assert');
if (!common.isMainThread)
common.skip('Error handling timing is different in Workers');
// If a process encounters an uncaughtException, it should schedule
// processing of nextTicks on the next Immediates cycle but not
// before all Immediates are handled
let stage = 0;
process.once('uncaughtException', common.expectsError({
type: Error,
message: 'caughtException'
}));
setImmediate(() => {
stage++;
process.nextTick(() => assert.strictEqual(stage, 2));
});
setTimeout(() => setImmediate(() => stage++), 1);
common.busyLoop(10);
throw new Error('caughtException');
|