In my node js app i want to catch the exception using domains.How can i do this.I have tried the below example but it showing error as 'Error: Cannot find module 'step''..
app.js
var domain=require('domain');
var mainDomain = domain.create();
mainDomain.run(function() {
fs.readFile(filename, 'utf8', mainDomain.intercept(function(data) {
console.log(data);
}));
});
mainDomain.on("error", function(error){
console.log(error);
});
Hopefully you solved this back in April. However, just to complete your post, I just had the same issue.
The error is thrown on the line:
var domain=require('domain');
The problem was to do with running earlier version of Nodejs. I installed the latest version (v0.10.21) and the problem is resolved.