Merge pull request #609 from STRML/master
Don't silently swallow db errors on validation.
This commit is contained in:
commit
87490d6851
|
@ -344,9 +344,8 @@ function validateUniqueness(attr, conf, err, done) {
|
||||||
|
|
||||||
this.constructor.find(cond, function (error, found) {
|
this.constructor.find(cond, function (error, found) {
|
||||||
if (error) {
|
if (error) {
|
||||||
return err();
|
err(error);
|
||||||
}
|
} else if (found.length > 1) {
|
||||||
if (found.length > 1) {
|
|
||||||
err();
|
err();
|
||||||
} else if (found.length === 1 && (!this.id || !found[0].id || found[0].id.toString() != this.id.toString())) {
|
} else if (found.length === 1 && (!this.id || !found[0].id || found[0].id.toString() != this.id.toString())) {
|
||||||
err();
|
err();
|
||||||
|
|
Loading…
Reference in New Issue