Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch Handlebars render errors #147

Merged
merged 3 commits into from
Feb 27, 2020
Merged

Catch Handlebars render errors #147

merged 3 commits into from
Feb 27, 2020

Conversation

mohd-akram
Copy link
Contributor

Errors inside the readFile callbacks (such as from a Handlebars helper) crashed the app.

Checklist

  • run npm run test and npm run benchmark
  • tests and/or benchmarks are included
  • commit message and code follows Code of conduct

templates/error.hbs Outdated Show resolved Hide resolved
test/test-handlebars.js Outdated Show resolved Hide resolved
templates/error.hbs Outdated Show resolved Hide resolved
}
this.send(html)
} catch (e) {
this.send(e)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is going to return a JSON, there is not a handlebar feature like a 500 html service page?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK there isn't. The error can be caught in an error handler and you can display a 500 page there.

test/test-handlebars.js Outdated Show resolved Hide resolved
mohd-akram and others added 2 commits February 26, 2020 11:58
Co-Authored-By: Manuel Spigolon <behemoth89@gmail.com>
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina
Copy link
Member

@Eomm would you mind to push out a release?

@Eomm Eomm merged commit b0b26e2 into fastify:master Feb 27, 2020
@mohd-akram mohd-akram deleted the catch-handlebars-error branch May 3, 2020 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants