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
Throw exception on TemplateCacheWarmer failure #41922
Comments
Well, if you want to see template syntax errors in CI, run the Also, for templates, making it fail when a template cannot be parsed without errors would require adding a feature to exclude templates from the cache warmer. For instance, the templates shipped in DoctrineBundle for the profiler panels are relying on Twig functions provided by WebProfilerBundle. In a prod environment, you will not have WebProfilerBundle and so not those functions. This would make TemplateCacheWarmer fail when warming up the DoctrineBundle templates (that will never be used in prod as they are used only when you render the profiler, but they are still in the bundle). |
Ah, I wasn't aware of your second argument, thanks for the pointer. But that also means that |
…Kruppa) This PR was merged into the 5.4 branch. Discussion ---------- [TwigBundle] Improve comment on error silencing | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix #41922 | License | MIT | Doc PR | As discussed in the ticket, I think the comment needs to be more expressive. Commits ------- 51124d5 [TwigBundle] Improve comment on error silencing
Description
The TemplateCacheWarmer has been ignoring errors since its first release in 2015. But I wonder what the rationale behind this decision is, as a) I'd like errors to pop up as early as possible (i.e. in a CI pipeline where the cache is warmed), and b) other cache warmers do throw exceptions, so ignoring errors doesn't seem to be a general rule in warmers.
Currently all templates with errors are skipped, so errors only appear during runtime (this might also trigger errors when deploying into a readonly filesystem but I didn't test it).
Unfortunately the comment in the empty catch block doesn't tell us why errors are ignored.
tl;dr: I ask to consider the TemplateCacheWarmer to fail on error.
The text was updated successfully, but these errors were encountered: