Skip to content

Instantly share code, notes, and snippets.

@sam-github
Last active January 2, 2016 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sam-github/8309330 to your computer and use it in GitHub Desktop.
Save sam-github/8309330 to your computer and use it in GitHub Desktop.
var Emitter = require('events').EventEmitter;
var domain = require('domain');
d = domain.create();
d.enter()
d.on('error', function(er) {
d.exit();
ee.emit('report', function() {
console.log('reported, now throw');
setImmediate(function() {
throw er;
});
})
});
var ee = new Emitter; // should be in domain, d?
ee.on('report', function(cb) {
console.log('in report');
cb();
});
process.nextTick(function() {
throw Error('BANG');
});
var Emitter = require('events').EventEmitter;
var domain = require('domain');
d = domain.create();
d.enter()
d.on('error', function(er) {
d.exit();
ee.emit('report', function() {
console.log('reported, now throw');
throw er;
})
});
var ee = new Emitter; // should be in domain, d?
ee.on('report', function(cb) {
console.log('in report');
cb();
});
process.nextTick(function() {
throw Error('BANG');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment