Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ErrorHandler] merge and remove the ErrorRenderer component#34312

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

Merged
fabpot merged 2 commits intosymfony:4.4fromnicolas-grekas:eh-vd
Nov 12, 2019

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedNov 10, 2019
edited
Loading

QA
Branch?4.4
Bug fix?yes
New feature?yes
Deprecations?no
Tickets-
LicenseMIT
Doc PR-

This PR supersedes#34288.

Here is what it does:

  • Merge theErrorRenderer component intoErrorHandler
  • AddErrorRendererInterface::render(\Throwable $e): FlattenException and refactor error renderers around it.
  • AddFlattenException::setAsString() to make the previous possible.
  • AddCliErrorRenderer to render error on the CLI too. This meansVarDumper is now a required dependency ofErrorHandler. This paves the way to use it also for rendering HTML - the logic there is much more advanced than whatHtmlErrorRenderer provides and ever should provide.
  • MakeBufferingLogger map its collected logs toerror_log() if they are not emptied before.
  • Remove some classes that are not needed anymore (ErrorRenderer,ErrorRendererPass,HtmlErrorRendererInterface)
  • Simplified the logic inDebug::enable() - nobody uses its arguments
  • Fix a few issues found meanwhile.

With these changes, the component can be used standalone. One is now able to require only it, register it either with eitherErrorHandler::register() orDebug::enable() and profit.

yceruto, onEXHovia, dunglas, ahilles107, and sstok reacted with heart emoji
'exception' =>$exception,
'exception' =>newHttpException($code,'This is a sampleexception.'),
'logger' =>null,
'showException' =>false,
Copy link
Member

@ycerutoycerutoNov 10, 2019
edited
Loading

Choose a reason for hiding this comment

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

We are missing this attribute to show the non-debug version of the response (useful to test custom Twig-based HTML error pages) on e.g./__error/404.html.

Copy link
Member

@ycerutoycerutoNov 10, 2019
edited
Loading

Choose a reason for hiding this comment

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

However, I'm not sure it's useful for non-HTML formats.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'll let you follow up on this topic after merge if you don't mind.

yceruto reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

Done in#34331

@nicolas-grekasnicolas-grekasforce-pushed theeh-vd branch 2 times, most recently frome900eea to7f7312fCompareNovember 11, 2019 10:03
@nicolas-grekasnicolas-grekasforce-pushed theeh-vd branch 8 times, most recently fromb2d6471 tod3a7481CompareNovember 11, 2019 13:39
publicstaticfunctiongetSubscribedEvents()
{
return [
KernelEvents::CONTROLLER_ARGUMENTS =>'onControllerArguments',
Copy link
Member

@ycerutoycerutoNov 11, 2019
edited
Loading

Choose a reason for hiding this comment

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

It would be much better if we could add this listener only when necessary, i.e. within theonKernelException method.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I considered doing this but decided not: mutating the event-dispatcher at runtime is something we'd better avoid all the time. Also, this could introduce subtle order-dependent behaviors.
I think the check is specific enough for having it always enabled, with better unconditional behavior.

Copy link
Member

@ycerutoyceruto left a comment

Choose a reason for hiding this comment

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

It looks good to me as far as I've tried. However, we need another iteration to restore the preview mechanism.

Thank you Nicolas for taking over and improving it.

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

fabpot added a commit that referenced this pull requestNov 12, 2019
…onent (nicolas-grekas, yceruto)This PR was merged into the 4.4 branch.Discussion----------[ErrorHandler] merge and remove the ErrorRenderer component| Q             | A| ------------- | ---| Branch?       | 4.4| Bug fix?      | yes| New feature?  | yes| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -This PR supersedes#34288.Here is what it does:- Merge the `ErrorRenderer` component into `ErrorHandler`- Add `ErrorRendererInterface::render(\Throwable $e): FlattenException` and refactor error renderers around it.- Add `FlattenException::setAsString()` to make the previous possible.- Add `CliErrorRenderer` to render error on the CLI too. This means `VarDumper` is now a required dependency of `ErrorHandler`. This paves the way to use it also for rendering HTML - the logic there is much more advanced than what `HtmlErrorRenderer` provides and ever should provide.- Make `BufferingLogger` map its collected logs to `error_log()` if they are not emptied before.- Remove some classes that are not needed anymore (`ErrorRenderer`, `ErrorRendererPass`, `HtmlErrorRendererInterface`)- Simplified the logic in `Debug::enable()` - nobody uses its arguments- Fix a few issues found meanwhile.With these changes, the component can be used standalone. One is now able to require only it, register it either with either `ErrorHandler::register()` or `Debug::enable()` and profit.Commits-------d1bf1ca [ErrorHandler] help finish the PR6c9157b [ErrorHandler] merge and remove the ErrorRenderer component
@fabpotfabpot merged commitd1bf1ca intosymfony:4.4Nov 12, 2019
@nicolas-grekasnicolas-grekas deleted the eh-vd branchNovember 12, 2019 11:46
nicolas-grekas added a commit that referenced this pull requestNov 12, 2019
This PR was merged into the 4.4 branch.Discussion----------[TwigBundle] Restore the preview mechanism| Q             | A| ------------- | ---| Branch?       | 4.4| Bug fix?      | no| New feature?  | no| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -follow up#34312Commits-------d3f1121 [TwigBundle] Restore the preview mechanism
This was referencedNov 12, 2019
@fancywebfancyweb mentioned this pull requestDec 11, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@dunglasdunglasdunglas left review comments

@ycerutoycerutoyceruto approved these changes

@chalasrchalasrchalasr left review comments

@fabpotfabpotfabpot approved these changes

@srozesrozeAwaiting requested review from sroze

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

6 participants

@nicolas-grekas@fabpot@dunglas@yceruto@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp