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:
parent
9abffe4396
commit
708927335b
1 changed files with 8 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue