Skip to content

[HttpKernel] Add kernel.error event to handle uncaught \Error #34232

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 1 commit into from

Conversation

fancyweb
Copy link
Contributor

@fancyweb fancyweb commented Nov 4, 2019

Q A
Branch? 4.4
Bug fix? no
New feature? yes
Deprecations? no
Tickets #33065 (comment)
License MIT
Doc PR TODO

This PR adds the kernel.error event as suggested in #33065 (comment).

Only the second commit should be reviewed here.

@@ -66,7 +68,7 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ

try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
} catch (\Throwable $e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bc break. If I use the HttpKernel standalone, throwable did not trigger the exception event. Now it does.

Copy link
Member

Choose a reason for hiding this comment

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

We could change the $catch parameter of this method to allow for more fine-grained control over what should be caught.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about just having 2 channels, exception and error, and we hook the ExceptionListener on both events. Backward compatible and errors can still be handled in 4.4.

@nicolas-grekas
Copy link
Member

I'm proposing #34306 instead.

@nicolas-grekas
Copy link
Member

Closing in favor of #34306.
Thank you @fancyweb !

@fancyweb fancyweb deleted the http-kernel-error-event branch November 10, 2019 20:00
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.

5 participants