Server.js code (use connect-domain)

app.use(connectDomain());
require('./routers/paths')(app, routers, settings);
app.use(function(err, req, res, next) {
      global.controllers.debug.put(err, req.url);
       res.send(500, 'oops!');
});


Controller code:

mongoose.model('countries').find({}, 'id name', {sort: [['name', 1]]}, 
function(countries){
    setTimeout(function(){notExist();}, 100);
    notExist2();
    res.send(countries);
});

I don't handling both notExist, if I use "q":

Q.when(mongoose.model('countries').find({}, 'id name', {sort: [['name', 
1]]}).exec()).then(function(countries){
    setTimeout(function(){notExist();}, 100);
    notExist2();
    res.send(countries);
}).done();

So I catch only notExist2.

How I catch all errors in async functions?

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to