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

When provided callback to validate() throws an error that callback is being called again. #26

Open
ujasur opened this issue Apr 17, 2019 · 2 comments

Comments

@ujasur
Copy link

ujasur commented Apr 17, 2019

Message validator has the issue of calling the provided callback twice. It can cause error where it is assumed that function will be called once. For example:

var v = new MessageValidator('someurl');

function middleware(req, res, next) {
   v.validate(validMessage, function(err, message) {
       console.count('called');
       if (err) { 
          return next(new Error('Validation error:' + err.message )); 
       }
       // some code
       throw new Error('inside callback');
   });
}
@rulatir
Copy link

rulatir commented May 13, 2020

Any news on this? I am considering using this module, but this looks like a showstopper.

@jacoor
Copy link

jacoor commented Jan 14, 2021

eh, been just hit by this. Searching for other solution.
@ujasur made a fork and fixed it.
ujasur@d03aa24
Thank you!

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

3 participants