Created
April 16, 2013 06:57
-
-
Save robertklep/5393914 to your computer and use it in GitHub Desktop.
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 fs = require('fs'); | |
var mainDomain = domain.create(); | |
mainDomain.run(function() { | |
fs.readFile('foo', 'utf8', mainDomain.intercept(function(data) { | |
console.log(data); | |
})); | |
}); | |
mainDomain.on("error", function(error){ | |
console.log('An error occurred', error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i have tried your example but im getting following error .
} has no method 'create'
at Object. (/home/manigandan/workspace/WebMonitoringUsingGoogleAnalytics/errorHandling.js:6:25)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:40)