0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Added error handling for weird handlebars syntax

refs #10496

- handlebars if and unless helpers throw weird, unhelpful syntax errors
- for now, catch these errors and do something helpful with them
This commit is contained in:
Hannah Wolfe 2019-09-09 12:55:14 +01:00
parent 9abffe4396
commit 708927335b

View file

@ -39,6 +39,14 @@ _private.prepareError = (err, req, res, next) => {
err = new common.errors.NotFoundError({
err: err
});
} else if (err instanceof TypeError && err.stack.match(/node_modules\/handlebars\//)) {
// Temporary handling of theme errors from handlebars
// @TODO remove this when #10496 is solved properly
err = new common.errors.IncorrectUsageError({
err: err,
message: '{{#if}} or {{#unless}} helper is malformed',
statusCode: err.statusCode
});
} else {
err = new common.errors.GhostError({
err: err,