From b73f9f1bd44613acc3e113589a0f9c377cbd50f4 Mon Sep 17 00:00:00 2001 From: Samuel Reed Date: Thu, 28 May 2015 11:54:01 -0500 Subject: [PATCH] Don't silently swallow db errors on validation. --- lib/validations.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/validations.js b/lib/validations.js index 9568a057..102e04a6 100644 --- a/lib/validations.js +++ b/lib/validations.js @@ -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();