Merge pull request #609 from STRML/master

Don't silently swallow db errors on validation.
This commit is contained in:
Raymond Feng 2015-05-28 13:08:03 -07:00
commit 87490d6851
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();