Created
January 12, 2013 21:22
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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