Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[ERROR PAGES] Improve override documentation #18737

Copy link
Copy link
Open
@JLepeltier

Description

@JLepeltier
Issue body actions

It like theirs is few missing cases on overriding error page :

  1. PHP errors:

If you have PHP errors like TypeError or Division by zero
Then you can Override the Symfony\Component\HttpKernel\Controller\ErrorController using the service.yml when in production env.
You will just have the exception to render your page but you still can use Twig.

  1. Errors that happens before Twig was initialized

This can happen when you do not have a connection to your database for instance.
Then you need to set the template of HtmlErrorRenderer on your kernel :
HtmlErrorRenderer::setTemplate($this->getProjectDir().'/templates/error.html');

  1. The PHP is not responding (503)

It might be good to mention that you should configure a pure html error page on your upper layers like nginx/apache/traffeik/varnish/...

Note : I'm not sure this the best way to solve this issues but I think the doc should mention that you do not catch 100% of errors with Overriding the Default Error Templates or Overriding the Default ErrorController.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.