Closed
Description
hey,
I'm using async.js waterfall method together with sequelize to prevent 'callback chains of doom'. One scenario I'm regularly confronted with is that the first call in a chain is a select query and the following parts of the chain deal with the result of this select ... most of the time this results in code like this:
async.waterfall([...
function(callback) {
Client.find(:id).done(function(err, res) {
if(err !== null) callback(err);
else if(res !== null) callback(new Error('Sorry no DB entry could be found!'));
else callback(null, res);
}):
},
function(client, callback) {...
... it would be nice to have an extra flag in Sequelize to produce an error if there is no result available so I could just pass trough my callback to done() and handle the errors in async's final method.