blob: faa57df1277083dc220548d5b65d46563a5ca402 (
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
27
28
29
30
31
32
33
34
|
'use strict';
const common = require('../common');
var domain = require('domain');
var assert = require('assert');
var timeout;
var timeoutd = domain.create();
timeoutd.on('error', common.mustCall(function(e) {
assert.equal(e.message, 'Timeout UNREFd', 'Domain should catch timer error');
clearTimeout(timeout);
}));
timeoutd.run(function() {
setTimeout(function() {
throw new Error('Timeout UNREFd');
}).unref();
});
var immediated = domain.create();
immediated.on('error', common.mustCall(function(e) {
assert.equal(e.message, 'Immediate Error',
'Domain should catch immediate error');
}));
immediated.run(function() {
setImmediate(function() {
throw new Error('Immediate Error');
});
});
timeout = setTimeout(function() {}, 10 * 1000);
|