You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);elseif(res!==null)callback(newError('Sorry no DB entry could be found!'));elsecallback(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.
The text was updated successfully, but these errors were encountered:
Does this still pose an issue for you, i.e. would you still like to see this in sequelize?
Do you propose doing this on global basis, per DAO basis or per call basis. My suggestion would be to do it per call, or maybe per DAO so you can still allow some queries to return an empty result
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:
... 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.
The text was updated successfully, but these errors were encountered: