Created
September 10, 2012 20:50
-
-
Save kristjan/3693757 to your computer and use it in GitHub Desktop.
This file contains hidden or 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'); | |
process.on('uncaughtException', function(err) { | |
console.log('Pre caught', err.message); | |
}); | |
var d = domain.create(); | |
d.on('error', function(err) { | |
console.log("Domain caught", err.message); | |
}); | |
d.run(function() { | |
process.nextTick(function() { | |
throw new Error("Boom"); | |
}); | |
}); | |
process.on('uncaughtException', function(err) { | |
console.log('Post caught', err.message); | |
}); |
This file contains hidden or 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
Domain caught Boom | |
Pre caught Boom | |
Post caught Boom |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment