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

De-clutter the Symfony error reporting setup #1758

Open
phavekes opened this issue Nov 29, 2024 · 0 comments
Open

De-clutter the Symfony error reporting setup #1758

phavekes opened this issue Nov 29, 2024 · 0 comments

Comments

@phavekes
Copy link
Member

This issue is imported from pivotal - Originaly created at Aug 20, 2019 by Michiel Kodde

At this point, we receive an error situation from the kernel error listeners. This is the famous file with the longest if/elseif construction in history. Where certain exception types are matched with a custom error report.

They are then redirected to the FeedbackController who in turn renders a custom twig error template. Before doing so, twig functions are used to gather important error details. The Feedback Twig extension is a good example of this. It uses the Corto application object to load the feedback information from the session.

Needless to say. This setup can be improved upon. And #107565968 is an important part of doing so.

Instead of waiting for Corto to become obsolete. We can start with cleaning up technical debt in the way we now render the error templates.

A first effort was undertaken to fix this issue. The remnants can be found in: the optimize-error-routing feature branch.

In short, the following change was proposed and partly executed. But ended due to scope creep:

  1. Routing configuration in feedback.yml is amended with additional route parameters. Being a page identifier and the expected HTTP error code.
    1. The page identifier should be used to load the custom error message and page title from the translations file.
    2. The error code will be used in the response to set the appropriate error code.
  2. Any FeedbackController routes that do custom logic can be kept, all other routes should be updated to the generic error feedback route (already implemented in the branch)
  3. Those errors using the generic route can be rid of their custom twig template. And a generic twig template should be introduced.
  4. Some additional complexion lies in the retrieval of the feedback information. A new helper should be introduced. Tasked with retrieving this information from the Corto application session. This was partly implemented in the feature branch.
  5. The custom translations for the error pages need to be translated. In doing so, the organization noun and other translation overrides must be applied. This was previously done in a twig extension of the translation function. This might need to move?

Greatest reason for not doing these tasks under the boyscout rule is the amount of changes required to apply this change. Additional tests, updating of tests, and rigorous user testing are required when applying this change.

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

1 participant