before() issue #76

Closed
birdroidcn opened this Issue Jan 11, 2013 · 1 comment

Comments

Projects
None yet
3 participants

source code in filterService.js

Service.prototype.beforeFilter = function(msg, session, cb) {
  var index = 0, self = this;
  var next = function(err, resp) {
    if(index >= self.befores.length) {
      // if done
      cb();
      return;
    }
    if(err) {
      // if error
      cb(err, resp);
      return;
    }

    var handler = self.befores[index++];

If next function has err , cb(err,resp) will be called .But if last beforeHandler has err,cb() will be called ,because index >= befores.length.Is it a bug?

Contributor

changchang commented Jan 11, 2013

Yeah, it is a bug. I will fix it. Thanks~ :)

cynron closed this Dec 10, 2013

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