diff --git a/src/plugins/hooks.js b/src/plugins/hooks.js index 6a2751545a..1d6c6f8e7b 100644 --- a/src/plugins/hooks.js +++ b/src/plugins/hooks.js @@ -123,12 +123,18 @@ module.exports = function(Plugins) { next(); }, 5000); - hookObj.method(params, function() { + try { + hookObj.method(params, function() { + clearTimeout(timeoutId); + if (!timedOut) { + next.apply(null, arguments); + } + }); + } catch(err) { + winston.error('[plugins] Error executing \'' + hook + '\' in plugin \'' + hookObj.id + '\''); clearTimeout(timeoutId); - if (!timedOut) { - next.apply(null, arguments); - } - }); + next(); + } } else { next(); }