Skip to content
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

Changed typeof err #2553

Closed
hex7c0 opened this issue Dec 20, 2014 · 4 comments
Closed

Changed typeof err #2553

hex7c0 opened this issue Dec 20, 2014 · 4 comments
Milestone

Comments

@hex7c0
Copy link

hex7c0 commented Dec 20, 2014

Hi guys,
with version 3.9.7 (unstable), unlike since <= 3.9.6
errargument, on callback function, is changed from null to undefined
is that correct?

@vkarpov15
Copy link
Collaborator

What function are you passing a callback to that you get this issue?

@vkarpov15 vkarpov15 added this to the 4.0.0-rc0 milestone Dec 31, 2014
@hex7c0
Copy link
Author

hex7c0 commented Jan 1, 2015

hi Valeri
here is the snippet

// 3.9.7
mongo.model
        .where(where)
        .sort('species')
        .select(selected)
        .find(function(err, found) {

          console.log(where) // {}
          console.log(selected) // species name
          console.log(err) // undefined
          if (err !== null) {
            debug(err.message);
          }
});
// 3.9.6
mongo.model
        .where(where)
        .sort('species')
        .select(selected)
        .find(function(err, found) {

          console.log(where) // {}
          console.log(selected) // species name
          console.log(err) // null
          if (err !== null) {
            debug(err.message);
          }
});

@vkarpov15
Copy link
Collaborator

Yeah I think this may be related to some work done to add hooks for find. From what I've seen it's more idiomatic to return null instead of undefined in callback errors. I'll fix this. Thanks for your feedback :)

@hex7c0
Copy link
Author

hex7c0 commented Jan 2, 2015

you're welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants