Skip to content

Decorate standard error.html.twig template #27071

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

Closed
wants to merge 6 commits into from
Closed

Conversation

zorn-v
Copy link

@zorn-v zorn-v commented Apr 27, 2018

Q A
Branch? 3.4
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets #22964
License MIT

_003

@nicolas-grekas nicolas-grekas added this to the next milestone Apr 27, 2018
@zorn-v
Copy link
Author

zorn-v commented Apr 28, 2018

It does not resolve GLOBAL problems that discussed in appropriate tickets. It just brings nice default error page for standard symfony installation in prod env.

@zorn-v
Copy link
Author

zorn-v commented Apr 30, 2018

Guys, it just update OLD (check it out) ugly standard twig template. Nothing more.

@jvasseur
Copy link
Contributor

I'm 👎 because these are templates that are shown in production environment so we should show something as neutral as possible (they should be overridden on each projects to match your site style).

@zorn-v
Copy link
Author

zorn-v commented Apr 30, 2018

You prefer to see "White page with 'Oops'" ?
Some projects no need to define their own error pages. But symfony default is disgrace.

@sstok
Copy link
Contributor

sstok commented Apr 30, 2018

At least remove the exception-ghost as this is not really an exception, and non-technical users might be confused about this.

@zorn-v
Copy link
Author

zorn-v commented Apr 30, 2018

At least remove the exception-ghost

Yep, I expected it 😄
Ghost gives charm. If it were is no difficult to change "exception" to "error" I'd did it of course.
I can try to remove "exception" cloud at all.

@derrabus
Copy link
Member

You prefer to see "White page with 'Oops' ?"

Yes, mainly because the framework should not expose itself in prod. That exception ghost and the page layout you chose do exactly that.

Also, that error page is end-user facing. That user probably does not know what an exception is. The fact that Symfony uses exceptions to produce 40x/50x error pages is an implementation detail that the original layout hides. The red color indicates that the user did something wrong, which is not necessarily the case.

But symfony default is disgrace.

Please try to use a more respectful language.

@zorn-v
Copy link
Author

zorn-v commented Apr 30, 2018

Yes, mainly because the framework should not expose itself in prod.

And users of freamework says. It is UGLY. Just coz dont configure error pages...

@zorn-v
Copy link
Author

zorn-v commented Apr 30, 2018

When I show error page (not configured 404) from silex, I was asked - "Why it is not in symfony ?"

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Apr 30, 2018

the framework should not expose itself in prod

technically, the framework already exposes itself: the basic page is still something specific to Symfony, if one were to build heuristics to snif which code is generating this page.

I like the goal here personally.

@derrabus
Copy link
Member

derrabus commented Apr 30, 2018

the basic page is still something specific to Symfony, if one were to build heuristics

Yes, and even without the error pages, you can probably tell by analyzing runtime behavior like HTTP headers etc. My comment was not security-related.

I'd rather like avoid to use Symfony branding on end-user facing templates which the exception ghost and the layout with the read header are. Users seeing that page should get the impression that there's something broken with the application they're using. They should not get the impression of a "broken Symfony", imho.

I like the goal here personnaly.

Agreed. I'm not against changing the default error page in general. I just have concerns regarding the layout proposed in this PR.

@zorn-v
Copy link
Author

zorn-v commented Apr 30, 2018

I'd rather like avoid to use Symfony-branding on end-user

Why ? Is it not cool, knowing that some site using symfony ? )
Just because error pages. (as now BTW)

Just changed template. At all

@zorn-v
Copy link
Author

zorn-v commented Apr 30, 2018

BTW. I like 'branding' of symfony.
See what you can take, and that it is better to send to long journey 😄

@zorn-v
Copy link
Author

zorn-v commented Apr 30, 2018

I'd rather like avoid to use Symfony branding

Nah. Is "Oops" white page not "Symfony branding" ? Disgrace ?

@derrabus
Copy link
Member

Disgrace ?

Again, I don't think calling the work of someone a "disgrace" is a helpful contribution to a discussion.

@nicolas-grekas
Copy link
Member

Shouldn't we just remove the ghost and keep the rest? It'd look OK to me.

@javiereguiluz
Copy link
Member

I disagree with this proposal too. The reason is that I don't want to make users think that it's OK to not customize the error pages in their apps. That's why our default error pages in prod should look like real and finished error pages. Also, not leaking any detail or information about Symfony is nice ... although some people can now associate the "Oops ..." message to Symfony.

@nicolas-grekas
Copy link
Member

Either we refuse this proposal, or we fix #22964. Right now we have a mix.

@zorn-v
Copy link
Author

zorn-v commented Apr 30, 2018

I remove "exception" cloud, when I be able.

don't want to make users think that it's OK to not customize the error pages in their apps

And because of this we provide ugly pages (BTW, in SILEX it MUCH BETTER).

@zorn-v
Copy link
Author

zorn-v commented May 3, 2018

_006

@nicolas-grekas
Copy link
Member

@zorn-v looks great to me. Could you please update the ghost in the Debug component also? The word exception is used in prod there also, but this is not desired.

@zorn-v
Copy link
Author

zorn-v commented May 4, 2018

Is it ok, that typehints are removed from constructor for 3.4 compat ?

@nicolas-grekas
Copy link
Member

Yes it is. Is it required? Tests fail without?

@zorn-v
Copy link
Author

zorn-v commented May 4, 2018

Nope, but I think I make mistake when used master branch as base instead of 3.4

@nicolas-grekas
Copy link
Member

This is not a bug fix so master is correct :)

@zorn-v
Copy link
Author

zorn-v commented May 4, 2018

Yep, this is not bugfix. But WHY users of "old" versions of symfony (coz not php 7.1 on server) should see white page ?

@nicolas-grekas
Copy link
Member

Because we cannot support everyone. We have policies and they help us keep the maintenance burden handleable.

@zorn-v
Copy link
Author

zorn-v commented May 4, 2018

I agree. One time step against... and we have anarchy.
Just forgot.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With minor comment.
We must display something, and however raw we may want it, it doesn't have to be ugly.
Also the current situation is inconsistent, with the themed page being displayed in prod also by the Debug component, while the B&W one is when Twig is enabled.

@@ -36,7 +36,7 @@ class ExceptionHandler
private $caughtLength;
private $fileLinkFormat;

public function __construct(bool $debug = true, string $charset = null, $fileLinkFormat = null)
public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be reverted

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eeeh. I asked about this )

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, BTW

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the answer :)
The composer.json of the component states that php7.1 is required, so scalar type hints can be used.

@zorn-v
Copy link
Author

zorn-v commented May 4, 2018

We must display something, and however raw we may want it, it doesn't have to be ugly.

EXACTLY.
#27071 (comment)
I didn't pay much attention before I was asked. WHY I MUST to configure error page if I dont want ?

@javiereguiluz
Copy link
Member

I'm still 👎 about this proposal. The proposed decoration feels "out of place" for prod pages. The "Symfony ghost" and the rest of elements have been created for the dev pages.

If we want to display a non-ugly error page, we could do something like this, which is totally agnostic and doesn't leak any Symfony design or information:

error-404

error-500

@javiereguiluz
Copy link
Member

In case you think my last proposal is "too simple" or "not ready for prod", this is Google's 404 error page in production:

google-404-error

@zorn-v
Copy link
Author

zorn-v commented May 22, 2018

The "Symfony ghost" and the rest of elements have been created for the dev pages.

Smells like discrimination. Users of my projects not worthy cool error page if I lazy to override it ?
Is not "like a google" MUST override standard error page if they will be doing project with symfony ?

@andrewmy
Copy link
Contributor

Users of my projects not worthy cool error page if I lazy to override it ?

Yep.

@joshlopes
Copy link

joshlopes commented May 25, 2018

👎 Mostly because:

  1. Red is generally a bad colour to give to people that don't understand, they would probably think either the website is a scam / fake / wrong, or it was actually the site intention to give you that page.
  2. For us DEVs we can actually associate that template to a dev / test enviromnent if i saw that page in production i would think i had debug enabled or some other env was being used, which would be completely misleading.
  3. I prefer white (happy pages) even to show an error - which needs to be imo "naked" and clear to the user it was not part of my website.

I'm happy with @javiereguiluz proposal, I think google got it right, and nothing better to show to the users than something they are used to.

@zorn-v
Copy link
Author

zorn-v commented May 28, 2018

👎 Mostly because:

You could override it, no ?
Just like now.

@zorn-v
Copy link
Author

zorn-v commented May 28, 2018

I'm happy with @javiereguiluz proposal,

But nobody seems this problem before, yaah.

@joshlopes
Copy link

joshlopes commented May 29, 2018

@zorn-v please don't misunderstand me/us. We are grateful for your contribution.

AFAIK PR's are reviewed by the community, and i think something that doesn't please the majority, usually the author has to re-consider and take in consideration others opinions. I think the majority, currently, is engaged with the idea (so good job!) but the template used is inadequate.

You could override it, no?

This also applies to you, everyone can override... But this PR will change everyone's template (no one would merge something, only to have it overridden on millions of projects...). Not that i would override this template, but for the reasons i stated i won't be happy with this template either.

But nobody seems this problem before, yaah.

To be honest, for the reasons above... the blank pages suffice for my needs. I think i can speak for all of us, when i say, we try to avoid errors (so styling this error page has never been a priority for many of us). The current blank page, states that there is an error in a way i am sure the user will understand something was off with his request. This PR could fix some issues like sending the user back to homepage.

It's up for the authors of symfony to decide, as they have the last word. But currently, it would be a lot easier just to change it to match the majority expectations.

If i may ask you, what are the reasons for you to keep this red template? (similar to debug / dev pages) ?

@zorn-v
Copy link
Author

zorn-v commented May 29, 2018

To be honest, for the reasons above... the blank pages suffice for my needs.

Yep. Same for me. But I was asked of my friend wich I learn for symfony. Why is my old project (in silex) have cool error page, but symfony one not.

@joshlopes
Copy link

@zorn-v I'm sorry but that's not a good reason to keep a red template (re-use the debug / dev template), so we can have a "cool" error page. I think in such special cases you would indeed override the template in your project...

But since you already had all this work, what about doing what @javiereguiluz purposed above? or something similar? that would be great, and if you ask me you would be cool as any sf contributor 😎 , here take yours 🕶

@javiereguiluz
Copy link
Member

@zorn-v as you can see in the previous comments, most people are in favor of a simpler error page design. This doesn't mean that you are wrong; it's just that we think differently about this.

For this reason I've made some changes in your original pull request to implement this simpler design. This is how it looks:

simple-error-pages

It uses the same font stack as used by modern CSS frameworks and it uses the same red color shade as the "danger" text color of Bootstrap 4, ensuring a right contrast ratio. Thanks!

@javiereguiluz
Copy link
Member

@zorn-v as you requested, I'm closing this pull request and creating a new one with the latest changes: #27699. Thanks!

fabpot added a commit that referenced this pull request Jun 25, 2018
…reguiluz)

This PR was merged into the 4.2-dev branch.

Discussion
----------

Redesigned the default error page in production

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22964
| License       | MIT
| Doc PR        | -

This continues the work done in #27071.

Before/After comparison:

![before-after-prod-error-pages](https://user-images.githubusercontent.com/73419/41844084-6e132208-786f-11e8-97c9-53602395e231.png)

Commits
-------

1df8b3e Redesigned the default error page in production
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
@zorn-v
Copy link
Author

zorn-v commented Dec 6, 2020

Thanks, guys 😄

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

Successfully merging this pull request may close these issues.

9 participants