Don't silently swallow db errors on validation.

This commit is contained in:
Samuel Reed 2015-05-28 11:54:01 -05:00
parent e8e3ce6688
commit b73f9f1bd4
1 changed files with 2 additions and 3 deletions

View File

@ -344,9 +344,8 @@ function validateUniqueness(attr, conf, err, done) {
this.constructor.find(cond, function (error, found) {
if (error) {
return err();
}
if (found.length > 1) {
err(error);
} else if (found.length > 1) {
err();
} else if (found.length === 1 && (!this.id || !found[0].id || found[0].id.toString() != this.id.toString())) {
err();