chriso/node-validator — pull request #148 by cmawhorter (2013-02-03 11:17:37+00:00)
Title: throw ValidatorError instead of general Error

First... a warning, it's late ;]

The documentation suggests that check should be wrapped in a try/catch. This can lead to problems if you're eventually passing the error message back to the end user.

By throwing a ValidatorError instead of Error, we can more easily prevent unwanted error leakage.

```
try {
// validate
} catch(e) {
if (e instanceof validator.ValidtorError) sendErrorToUser(e);
else logIt(e);
}