1'use strict'; 2 3const common = require('../common'); 4const domain = require('domain'); 5 6function test() { 7 const d = domain.create(); 8 9 d.run(function() { 10 const fs = require('fs'); 11 fs.exists('/non/existing/file', function onExists() { 12 throw new Error('boom!'); 13 }); 14 }); 15} 16 17if (process.argv[2] === 'child') { 18 test(); 19} else { 20 common.childShouldThrowAndAbort(); 21} 22