Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

callback returning as error while its not erroring

exports.CheckPassword("Ender","plaintextpassword",callback) 
function callback(err, result) {
  if (err) {
   exports.Error("Password test " + err);
  } else {
    console.log("Password test " + result);
  }
}

When using callback(true) in the callback function it errors when it doesnt in the CheckPassword function
The error

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Your method is expecting error as first argument and result as second.

When you pass true to your callback it understand error as true.

Ideally, it should expect result first and error as an optional argument

function callback(result, err) {// remaining code will ve as it it}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading