2016-12-19 12:19:18 +08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
const domain = require('domain');
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
const d = domain.create();
|
|
|
|
const d2 = domain.create();
|
|
|
|
|
|
|
|
d.on('error', function errorHandler() {
|
|
|
|
});
|
|
|
|
|
2017-12-18 17:56:43 +09:00
|
|
|
d.run(() => {
|
|
|
|
d2.run(() => {
|
2016-12-30 18:38:06 -05:00
|
|
|
const fs = require('fs');
|
2016-12-19 12:19:18 +08:00
|
|
|
fs.exists('/non/existing/file', function onExists() {
|
|
|
|
throw new Error('boom!');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (process.argv[2] === 'child') {
|
|
|
|
test();
|
|
|
|
} else {
|
|
|
|
common.childShouldThrowAndAbort();
|
|
|
|
}
|