-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[ErrorHandler] Render template with status code assigned to the exception #44456
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing this bug. Some small changes to make it ready.
src/Symfony/Component/ErrorHandler/Tests/ErrorRenderer/HtmlErrorRendererTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/ErrorHandler/Tests/ErrorRenderer/HtmlErrorRendererTest.php
Outdated
Show resolved
Hide resolved
bfa0e29
to
6a57d95
Compare
@GromNaN Thanks for the review! I'm not sure how I can fix the tests in the pipeline. Where can I read more about Also, it throws some linting error about extra return in phpdoc, but this is not related to my change, so I put it back. |
This error a not related to your changes. There is the same errors on the target branch (5.4).
You can apply the patch from fabbot please. |
done. I thought the pipeline should be all green in order to merge :) Anything else I can/should do in this branch? |
ff99b45
to
dd6a939
Compare
For API exceptions it's the same problem. @aderiyenko can you also update |
@yceruto sure, will look at it and try to do the same there and I saw your idea in the issue comments, so let me try to create another PR with another approach. I'll try to finish this one over the weekend and then will start with wrapping it into an http exception idea |
1939d4f
to
480da75
Compare
@yceruto I added the same functionality to |
26d9bb9
to
ba34b94
Compare
changed the wording of the additional config (exception type -> log_level/status code) parameter everywhere and also changed the hardcoded constants (status codes and texts) in tests to use the ones from HttpFoundation\Response |
ba34b94
to
b2df1f6
Compare
@GromNaN I see that my new tests pass in 7.4 pipeline, but fail in 8. See here: https://github.com/symfony/symfony/runs/4422885653?check_suite_focus=true . Problem is: I just tried to launch it inside a php:8.0.5-fpm-alpine container (with only xdebug3 installed) and it passes fine, so I can't recreate it locally. Is there any specific config in the pipeline that I can reproduce locally ? |
Is my understanding correct that low- and high-deps pipelines install all components of certain versions, so the tests covering the new functionality in any PR will never work in those pipeline steps? Because these versions do not have the functionality being tested? |
@aderiyenko you should update the affected composer.json accordingly to make it pass. For example, after these changes FrameworkBundle is no longer compatible with |
@yceruto this is a bugfix, I think we should not update the dependencies in that case. |
You're right, I confused the branch this PR targeted. Initially, it was 6.1. |
Iirc, in that case, require the upcoming minor version: |
Thanks everyone! I just bumped the versions of error handler in FrameworkBundle's composer.json , but the same errors are still there. But I'm more interested if there are certain steps I can take locally to reproduce the problem? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR, I really appreciate that you took the time to write and submit it.
Having reviewed the code, the added logic doesn't make sense to me. It feels like spreading a concern to places where it doesn't belong.
On a closer look, I think the implementation provided in #42244 is at fault and that it should be changed.
I gave it a try and submitted it at #44649.
Thanks again. I'm 👎 here as explained.
Sure, thanks @nicolas-grekas |
… by exception works (nicolas-grekas) This PR was merged into the 5.4 branch. Discussion ---------- [HttpKernel] fix how configuring log-level and status-code by exception works | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #44433 | License | MIT | Doc PR | - This PR replaces #44456, and essentially fixes the way configuring log-level/status-code by exception works: instead of hacking them in the listener, the original exception should be wrapped in an `HttpExceptionInterface`, so that the rest of the code can seamlessly know about the configuration. Commits ------- 6617be4 [HttpKernel] fix how configuring log-level and status-code by exception works
framework.exceptions
config intoSymfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer
FlattenException::createFromThrowable()