From 17bc8d4f8034bb9f08fc4ce72cb9b0868cb06e72 Mon Sep 17 00:00:00 2001 From: Evan Tahler Date: Fri, 18 Mar 2016 15:43:57 -0700 Subject: [PATCH] if there is an error when running a plugin, always return the error --- lib/pluginRunner.js | 8 +++++--- package.json | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/pluginRunner.js b/lib/pluginRunner.js index c7cddedc..03e9fe50 100644 --- a/lib/pluginRunner.js +++ b/lib/pluginRunner.js @@ -3,7 +3,7 @@ var runPlugin = function(self, pluginRefrence, type, func, queue, job, args, cal if(!job){ callback(null, true); }else{ - + var pluginName = pluginRefrence; if(typeof pluginRefrence === 'function'){ pluginName = new pluginRefrence(self, func, queue, job, args, {}).name; @@ -25,7 +25,7 @@ var runPlugin = function(self, pluginRefrence, type, func, queue, job, args, cal } else { throw new Error('Plugin must be the constructor name or an object'); } - + if(plugin[type] === null || plugin[type] === undefined || typeof plugin[type] !== 'function'){ callback(null, true); }else{ @@ -49,7 +49,9 @@ var runPlugins = function(self, type, func, queue, job, args, callback, pluginCo var pluginRefrence = job.plugins[pluginCounter]; runPlugin(self, pluginRefrence, type, func, queue, job, args, function(err, toRun){ pluginCounter++; - if(toRun === false){ + if(err){ + callback(err, toRun); + }else if(toRun === false){ callback(err, false); }else{ runPlugins(self, type, func, queue, job, args, callback, pluginCounter); diff --git a/package.json b/package.json index a4848066..85577e7e 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "name": "node-resque", "description": "an opinionated implementation of resque in node", "license": "Apache-2.0", - "version": "2.0.2", + "version": "2.0.3", "homepage": "http://github.com/taskrabbit/node-resque", "repository": { "type": "git",