-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
Conversation
1f7bc72
to
60d0fc4
Compare
@@ -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) { |
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.
This is a bc break. If I use the HttpKernel standalone, throwable did not trigger the exception event. Now it does.
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.
We could change the $catch
parameter of this method to allow for more fine-grained control over what should be caught.
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.
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.
60d0fc4
to
aebe6d5
Compare
I'm proposing #34306 instead. |
This PR adds the
kernel.error
event as suggested in #33065 (comment).Only the second commit should be reviewed here.