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.0] Replace Generic error message with a shiny one. #29968

Closed
PhilETaylor opened this issue Jul 4, 2020 · 7 comments
Closed

[4.0] Replace Generic error message with a shiny one. #29968

PhilETaylor opened this issue Jul 4, 2020 · 7 comments

Comments

@PhilETaylor
Copy link
Contributor

PhilETaylor commented Jul 4, 2020

Steps to reproduce the issue

install Joomla 4
once installed turn off the mysql server (or make a new typo in the mysql credentials in /configuration.php)

Expected result

In Joomla 3 we just got white screen of death with "Error" on it.

In Joomla 4 we have the opportunity to make the generic error page beautiful - or at least allow the text to be translated/edited by Super Admins

Actual result

The default Symfony error page is displayed

Screenshot 2020-07-04 at 15 48 03

@PhilETaylor PhilETaylor changed the title [4.0] Generic error message too techie... [4.0] Replace Generic error message with a shiny one. Jul 4, 2020
@PhilETaylor

This comment was marked as abuse.

@PhilETaylor

This comment was marked as abuse.

@PhilETaylor

This comment was marked as abuse.

@PhilETaylor PhilETaylor reopened this Jul 7, 2020
fabpot added a commit to symfony/symfony that referenced this issue Jul 7, 2020
… template (PhilETaylor)

This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[ErrorHandler] Allow override of the default non-debug template

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes - a very tiny one
| Deprecations? | no
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Add new feature to allow the default hardcoded non-debug template to be overridden when `symfony/error-handler`used as a component in other projects.

Currently, when used as a component, its not possible (that I could see) to override the standard default template of `views/error.html.php` therefore the look and feel, and text is hard coded. There is much written on how to customise the error pages when using the full symfony stack, but not when using individual `symfony/error-handler` component on its own.

This PR is related to the use of `symfony/error-handler` as a component in other projects - specifically the Joomla Content Management System, where, in non debug mode, a generic template **needs to be translatable, and customisable** even though most of the time when the error occurs will bt at boot time and not much available to it. joomla/joomla-cms#29968

This PR allows the use of code such as

```php
<?php

require 'vendor/autoload.php';

use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;

ErrorHandler::register();
HtmlErrorRenderer::setTemplate('/path/to/custom/mine.php');

throw new Exception('myException is this', 500);
```

and then for further customisation of the "look and feel" to be done in `mine.php`

Due to the unique way the error handler component is init'ed, the use of static calls has been employed rather than any DI approach, I hope this is ok.

Commits
-------

6e1d16b [ErrorHandler] Allow override of the default non-debug template
@PhilETaylor

This comment was marked as abuse.

@ReLater
Copy link
Contributor

ReLater commented Jul 7, 2020

The question for me is "How?". Or will you provide a pr then?

@PhilETaylor

This comment was marked as abuse.

@PhilETaylor

This comment was marked as abuse.

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