Skip to content

[HttpKernel] Exceptions Responses are automatically sent #16205

@lcetinsoy

Description

@lcetinsoy

When an exception occurs in dev environment, the exception is catched and converted to a response which provides our nice symfony exceptions.

However it is sent automatically by Symfony\Component\HttpKernel\HttpKernel::terminateWithException() which does:

$response = $this->handleException($exception, $request, self::MASTER_REQUEST);
$response->sendHeaders();
$response->sendContent();

What is the reason for breaking the Request->Response workflow for exceptions ? You could send the response and let the front controller call response->send() as usual.

I am integrating a symfony app with a reactphp event loop. With such setup, I cannot send exceptions response to the client, they are printed to the console sadly displaying the whole markup.

[edit] I tried to override the aforementioned method but since handleException is private, I cannot call it from my subclass.

My current option is to output to an error.html file and display it with my browser.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions