Skip to content

Commit

Permalink
if there is an error when running a plugin, always return the error
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler committed Mar 18, 2016
1 parent c4e2926 commit 17bc8d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lib/pluginRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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{
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 17bc8d4

Please sign in to comment.