[5.x]: Extending a non-existent template in an element partial doesn't show a helpful error message
Closed this issue · 2 comments
What happened?
Description
If you extend a template that doesn't exist in an element partial template, you get the fallback behaviour (e.g. Entry 123
) instead of an exception view. That's because ElementHelper::renderElements()
catches all errors of type TwigLoaderError
to catch when an element partial doesn't exist, but that's the same error that's thrown when extending a template that doesn't exist.
I've opened a PR to fix this: #15177
Steps to reproduce
- Create an element partial template, e.g.
_partials/entry/home
and inside, extend a non-existant template:
{% extends "path/to/missing/template" %}
- Render an entry of that entry type:
{{ entry.render() }}
Expected behavior
Every error in element partials should show regular exception views.
Actual behavior
The error is silently discarded and the fallback behaviour of showing a string representation is used.
Craft CMS version
5.1.10
PHP version
8.3
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
Thanks for the report and PR! Merged for the next release.
Craft 5.2.0-beta.6 is out with that fix.