Skip to content
Browse files

Fail uniqueness check in case of db error

  • Loading branch information...
1 parent 573aace commit 451c0c86461e7292739f9b36a44bde3cfb973644 @1602 committed May 16, 2013
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/validations.js
View
3 lib/validations.js
@@ -287,6 +287,9 @@ function validateUniqueness(attr, conf, err, done) {
var cond = {where: {}};
cond.where[attr] = this[attr];
this.constructor.all(cond, function (error, found) {
+ if (error) {
+ return err();
+ }
if (found.length > 1) {
err();
} else if (found.length === 1 && (!this.id || !found[0].id || found[0].id.toString() != this.id.toString())) {

0 comments on commit 451c0c8

Please sign in to comment.
Something went wrong with that request. Please try again.