Advertisement
Guest User

Untitled

a guest
Jun 1st, 2013
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var domain = require('domain');
  2.  
  3. var d1 = domain.create(), d2 = domain.create();
  4.  
  5. d1.on('error', function(err) {
  6.     console.log('d1 fails', err.message);
  7. });
  8.  
  9. d2.on('error', function(err) {
  10.     console.log('d2 fails', err.message);
  11. });
  12.  
  13. d1.run(function() {
  14.     if (Math.random() > 0.99) {
  15.     throw new Error('d1 exception');
  16.     }
  17.     setTimeout(arguments.callee, 10);
  18. });
  19.  
  20. d2.run(function() {
  21.     if (Math.random() > 0.99) {
  22.     throw new Error('d2 exception');
  23.     }
  24.     setTimeout(arguments.callee, 10);
  25. });
  26.  
  27. (function() {
  28.     if (Math.random() > 0.99) {
  29.     throw new Error('free exception');
  30.     }
  31.     setTimeout(arguments.callee, 10);
  32. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement