You are here

public function HttpKernel::terminateWithException in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/HttpKernel.php \Symfony\Component\HttpKernel\HttpKernel::terminateWithException()

@internal

Throws

\LogicException If the request stack is empty

File

vendor/symfony/http-kernel/HttpKernel.php, line 87

Class

HttpKernel
HttpKernel notifies events to convert a Request object to a Response one.

Namespace

Symfony\Component\HttpKernel

Code

public function terminateWithException(\Exception $exception) {
  if (!($request = $this->requestStack
    ->getMasterRequest())) {
    throw new \LogicException('Request stack is empty', 0, $exception);
  }
  $response = $this
    ->handleException($exception, $request, self::MASTER_REQUEST);
  $response
    ->sendHeaders();
  $response
    ->sendContent();
  $this
    ->terminate($request, $response);
}