From 303ea87897833a70dc96af93e261e144da789e4f Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Thu, 25 Nov 2021 14:44:57 +0000 Subject: [PATCH] Removed overly-specific handling of handlebars errors refs: https://github.com/TryGhost/Ghost/issues/10496 refs: https://github.com/handlebars-lang/handlebars.js/issues/1548 - For a while, handlebars would and could generate quite a lot of obscure sytnax error messages for malformed helpers that we couldn't catch in gscan - This was fixed in https://github.com/handlebars-lang/handlebars.js/issues/1548 - We have also since added AST parsing to gscan, so if there are more obscure syntax errors, we should be able to add rules to catch them - Therefore, this additional, overly specific code block isn't needed anymore, so let's clean it up! --- core/server/web/shared/middleware/error-handler.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/core/server/web/shared/middleware/error-handler.js b/core/server/web/shared/middleware/error-handler.js index 59e8a610ef8a..7937af34b1ca 100644 --- a/core/server/web/shared/middleware/error-handler.js +++ b/core/server/web/shared/middleware/error-handler.js @@ -105,14 +105,6 @@ _private.prepareError = (err, req, res, next) => { err = new errors.NotFoundError({ err: err }); - } else if (err.stack.match(/node_modules\/handlebars\//)) { - // Temporary handling of theme errors from handlebars - // @TODO remove this when #10496 is solved properly - err = new errors.IncorrectUsageError({ - err: err, - message: err.message, - statusCode: err.statusCode - }); } else { err = new errors.GhostError({ err: err,