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

[4.x]: ErrorHandler doesn't render error and content-type while in devMode #11108

Closed
jordikroon opened this issue May 5, 2022 · 5 comments
Closed

Comments

@jordikroon
Copy link

jordikroon commented May 5, 2022

What happened?

Description

Twig Syntax errors result in errors not as HTML

Steps to reproduce

  1. Add a twig template file
  2. Add {{ dump('test') } (note missing closing bracket)

Expected behavior

image

Actual behaviour

image

Proposed fix

Since the error that is catched in TemplateResponseFormatter is only limited to RuntimeError, try use the parent class Error.

However I don't quite understand why the Format template is used. Because the format is "template", it results in the default behaviour of not having a content-type, and the parent class (line 192) not rendering the error. This is due to the fact that the format is not HTML or JSON.

Craft CMS version

4.0.0.1

PHP version

8.0

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

None

brandonkelly added a commit that referenced this issue May 6, 2022
@brandonkelly
Copy link
Member

Thanks for reporting that! Fixed for the next release.

@brandonkelly
Copy link
Member

Craft 4.0.1 is out now with the fix for this.

@jerome2710
Copy link

jerome2710 commented May 24, 2022

@brandonkelly I am currently experiencing this issue in 4.0.3 again as well.

My error is actually not an \Exception, but a \Throwable because of a TypeError in one of our plugins (under construction). Hence it is not catched by the TemplateResponseFormatter.

brandonkelly added a commit that referenced this issue May 24, 2022
@brandonkelly
Copy link
Member

@jerome2710 Alright, that’s fixed for the next release.

To get the fix early, change your craftcms/cms requirement in composer.json to "dev-develop as 4.0.3" and run composer update.

@brandonkelly
Copy link
Member

Craft 4.0.4 is out now with that fix.

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

No branches or pull requests

3 participants