Specifically, if there is an error, checkMemberCredits will execute the callback with a single truthy argument (the Error object). In the login handler, the callback we pass in only assumes a single argument, which it checks for truthiness. If the argument is truthy, it assumes the email exists. But actually, the argument will be truthy if there has been an error (because all objects are truthy). This is not the behaviour that is expected.
This is related to #20 because it can be addressed by using error-first callbacks
The
checkMembersCredits
function has the opposite behaviour to what is assumed by its user in the login handler.Specifically, if there is an error,
checkMemberCredits
will execute the callback with a single truthy argument (theError
object). In the login handler, the callback we pass in only assumes a single argument, which it checks for truthiness. If the argument is truthy, it assumes the email exists. But actually, the argument will be truthy if there has been an error (because all objects are truthy). This is not the behaviour that is expected.This is related to #20 because it can be addressed by using error-first callbacks