New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flag to emit an error if select result is null #272

m9dfukc opened this Issue Sep 20, 2012 · 1 comment


3 participants

m9dfukc commented Sep 20, 2012


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:

  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.


This comment has been minimized.


janmeier commented Feb 22, 2013

Hi @m9dfukc

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment