From b70867c97392104289395a6f3d4a6dfca28bfa2e Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Sun, 7 Jul 2013 19:02:26 +0100 Subject: [PATCH] Filters should not stop execution. - added a try-catch & error logging to filters so that they can be debugged and do not stop execution --- core/ghost.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/ghost.js b/core/ghost.js index 9be4d0b467..59c999e1d7 100644 --- a/core/ghost.js +++ b/core/ghost.js @@ -234,7 +234,12 @@ Ghost.prototype.doFilter = function (name, args, callback) { // Call each handler for this priority level _.each(callbacks[priority], function (filterHandler) { - args = filterHandler(args); + try { + args = filterHandler(args); + } catch (e) { + // If a filter causes an error, we log it so that it can be debugged, but do not throw the error + errors.logError(e); + } }); });