Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Added new ErrorController + Preview and enabling there the error renderer mechanism#33271
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
fabpot left a comment
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.
LGTM
src/Symfony/Bundle/FrameworkBundle/Controller/ErrorController.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Controller/PreviewErrorController.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Controller/PreviewErrorController.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
e64481f to9bc74f9Comparesrc/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExceptionListenerPass.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
yceruto commentedAug 22, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm introducing here a default exception controller that will use the error rendering mechanism. If you've a completely different error rendering system you'll can to replace the default controller configuring it on That possibility is available with TwigBundle installed (deprecated here), now it'll be possible with FrameworkBundle only. |
src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
yceruto commentedAug 24, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Update As there are two exception listeners when FrameworkBundle and TwigBundle are enabled, I've removed one conditionally: the This will be the migration path: twig:- exception_controller: 'App\Controller\ExceptionController'+ exception_controller: nullframework:+ error_controller: 'App\Controller\ExceptionController' |
1449e0f to2841e59Compareyceruto commentedAug 24, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
|
| } | ||
| // register the exception controller only if Twig is enabled and required dependencies do exist | ||
| if (!class_exists('Symfony\Component\ErrorRenderer\Exception\FlattenException') || !interface_exists('Symfony\Component\EventDispatcher\EventSubscriberInterface')) { |
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.
I've removed allinterface_exists() check here becase both interfaces are currently installed as hard deps.
yceruto commentedAug 24, 2019
This is ready for review! |
src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExceptionListenerPass.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
83755cb to7cce955Comparefabpot commentedSep 5, 2019
Thank you@yceruto. |
… the error renderer mechanism (yceruto)This PR was merged into the 4.4 branch.Discussion----------Added new ErrorController + Preview and enabling there the error renderer mechanism| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | yes| Tests pass? | yes (deps=high failure is normal)| Fixed tickets | -| License | MIT| Doc PR | TODOAfter deprecating the `ExceptionController` in TwigBundle (refs#31398) the `twig.exception_controller` config key becomes useless as feature provided by TwigBundle, while the preview controller is taking more relevance for the error renderer mechanish.**Proposal** * Deprecate the `twig.exception_controller` config key in favor of `framework.error_controller` with default `ErrorController` that activates the error renderer mechanism through the current `ExceptionListener`, meaning also that `DebugHandlersListener::onKernelException` method becomes useless too. * Deprecate the `PreviewErrorController` from TwigBundle in favor of similar in FrameworkBundle.So you no longer need to install TwigBundle to create a custom error controller or check the preview output of an error renderer (included `TwigHtmlErrorRenderer`).Btw this wouldfix#31398 (comment), removing here workaround in SecurityBundle.TODO:- [x] Update CHANGELOG & UPGRADE files- [x] Add testsWDYT?Commits-------b79532a Add ErrorController to preview and render errors
| // register the exception controller only if Twig is enabled and required dependencies do exist | ||
| if (!class_exists('Symfony\Component\ErrorRenderer\Exception\FlattenException') || !interface_exists('Symfony\Component\EventDispatcher\EventSubscriberInterface')) { | ||
| // to be removed in 5.0 |
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.
@yceruto can you please send a PR on master to cleanup this?
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.
See#33476
This PR was merged into the 5.0-dev branch.Discussion----------[TwigBundle] Remove legacy code| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | TODOSee#33271Commits-------abb3258 Remove legacy code
Uh oh!
There was an error while loading.Please reload this page.
After deprecating the
ExceptionControllerin TwigBundle (refs#31398) thetwig.exception_controllerconfig key becomes useless as feature provided by TwigBundle, while the preview controller is taking more relevance for the error renderer mechanish.Proposal
twig.exception_controllerconfig key in favor offramework.error_controllerwith defaultErrorControllerthat activates the error renderer mechanism through the currentExceptionListener, meaning also thatDebugHandlersListener::onKernelExceptionmethod becomes useless too.PreviewErrorControllerfrom TwigBundle in favor of similar in FrameworkBundle.So you no longer need to install TwigBundle to create a custom error controller or check the preview output of an error renderer (included
TwigHtmlErrorRenderer).Btw this wouldfix#31398 (comment), removing here workaround in SecurityBundle.
TODO:
WDYT?