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

[5.x]: Extending a non-existent template in an element partial doesn't show a helpful error message #15176

Closed
MoritzLost opened this issue Jun 11, 2024 · 2 comments
Labels

Comments

@MoritzLost
Copy link
Contributor

MoritzLost commented Jun 11, 2024

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

  1. Create an element partial template, e.g. _partials/entry/home and inside, extend a non-existant template:
{% extends "path/to/missing/template" %}
  1. 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

@brandonkelly
Copy link
Member

Thanks for the report and PR! Merged for the next release.

@brandonkelly
Copy link
Member

Craft 5.2.0-beta.6 is out with that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants