Skip to content

Instantly share code, notes, and snippets.

@bensheldon
Created January 12, 2013 21:22
Show Gist options
  • Save bensheldon/4520550 to your computer and use it in GitHub Desktop.
Save bensheldon/4520550 to your computer and use it in GitHub Desktop.
Disposing Node's domains can have some odd effects on other async functions being called. (Node v0.8.15)
var domain = require('domain');
var d = domain.create();
d.on('error', function(err) {
// d.dispose(); // the nextTick() function DOES get called
process.nextTick(function() {
console.error('Caught:', err);
})
// d.dispose(); // the nextTick() function does NOT get called
});
d.run(function() {
throw new Error ("something broke");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment