Advertisement
Guest User

Untitled

a guest
May 27th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. var domain = require("domain");
  2. var d = domain.create();
  3.  
  4. d.on("error", function() {
  5. console.log("domain caught");
  6. });
  7.  
  8. try {
  9. d.run(function() {
  10. process.nextTick(function() {
  11. throw new Error("foo");
  12. });
  13. });
  14. } catch (err) {
  15. console.log("try/catch caught");
  16. }
  17.  
  18. // result: domain caught
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement