mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
🐛 Fixed handling of Handlebars errors
no issue - Handlebars now throws an Error for misuse errors within the if/unless helpers, but our error handling checks for a TypeError - this would skip using an IncorrectUsageError and ends up throwing a GhostError - this commit removes the TypeError check and switches to using the Handlebars error message
This commit is contained in:
parent
a72c4e7905
commit
6d21bbfc63
1 changed files with 2 additions and 2 deletions
|
@ -41,12 +41,12 @@ _private.prepareError = (err, req, res, next) => {
|
|||
err = new errors.NotFoundError({
|
||||
err: err
|
||||
});
|
||||
} else if (err instanceof TypeError && err.stack.match(/node_modules\/handlebars\//)) {
|
||||
} 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: '{{#if}} or {{#unless}} helper is malformed',
|
||||
message: err.message,
|
||||
statusCode: err.statusCode
|
||||
});
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue