1'use strict'; 2 3const common = require('../common'); 4const domain = require('domain'); 5 6function test() { 7 const d = domain.create(); 8 const d2 = domain.create(); 9 10 d.on('error', function errorHandler() { 11 }); 12 13 d.run(function() { 14 d2.run(function() { 15 setImmediate(function() { 16 throw new Error('boom!'); 17 }); 18 }); 19 }); 20} 21 22if (process.argv[2] === 'child') { 23 test(); 24} else { 25 common.childShouldThrowAndAbort(); 26} 27