From dd4089d1c727f4ff1fb987864d926da45362b4b2 Mon Sep 17 00:00:00 2001 From: Zack Bloom Date: Tue, 13 May 2014 13:59:15 -0400 Subject: [PATCH] Fix bug where invalid relations in include filters would hang the server --- lib/include.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/include.js b/lib/include.js index 4060e55e..c459451b 100644 --- a/lib/include.js +++ b/lib/include.js @@ -96,10 +96,9 @@ Inclusion.include = function (objects, include, cb) { var relation = relations[relationName]; if (!relation) { - return function () { - cb(new Error('Relation "' + relationName + '" is not defined for ' - + self.modelName + ' model')); - }; + cb(new Error('Relation "' + relationName + '" is not defined for ' + + self.modelName + ' model')); + return; } // Calling the relation method for each object