mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -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:
parent
03f31bba9d
commit
617d861ca0
1 changed files with 8 additions and 0 deletions
|
@ -38,6 +38,14 @@ _private.prepareError = function 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,
|
||||
|
|
Loading…
Add table
Reference in a new issue