Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var domain = require('domain');
- var d1 = domain.create(), d2 = domain.create();
- d1.on('error', function(err) {
- console.log('d1 fails', err.message);
- });
- d2.on('error', function(err) {
- console.log('d2 fails', err.message);
- });
- d1.run(function() {
- if (Math.random() > 0.99) {
- throw new Error('d1 exception');
- }
- setTimeout(arguments.callee, 10);
- });
- d2.run(function() {
- if (Math.random() > 0.99) {
- throw new Error('d2 exception');
- }
- setTimeout(arguments.callee, 10);
- });
- (function() {
- if (Math.random() > 0.99) {
- throw new Error('free exception');
- }
- setTimeout(arguments.callee, 10);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement