Skip to content

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

Closed
@m9dfukc

Description

@m9dfukc

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.

Metadata

Metadata

Assignees

Labels

type: featureDEPRECATED: replace with the "feature" issue type

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions