guillaumepotier / validator.js

Powerful objects and strings validation in javascript for Node and the browser
http://validatorjs.org
MIT License
255 stars 39 forks source link

Catch errors in callback functions #30

Closed marcandre closed 9 years ago

marcandre commented 9 years ago

I'm not too sure how to best handle this issue, but a relatively simple solution is to change Callback to throw a Violation in case an error occurs while executing the callback. Let me know!

marcandre commented 9 years ago

Other possibility is to re throw other errors in both check functions so it bubbles up.

guillaumepotier commented 9 years ago

Hi @marcandre,

I just saw this PR today O_o.

This is a good idea, especially with the related Parsley issue. Thanks a lot!

Best

marcandre commented 9 years ago

Cool. Let me know when you make a release for validator