DrupalKernel::handleException

protected DrupalKernel::handleException(\Exception $e, $request, $type)

Converts an exception into a response.

Parameters

\Exception $e: An exception

Request $request: A Request instance

int $type: The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)

Return value

Response A Response instance

Throws

\Exception If the passed in exception cannot be turned into a response.

File

core/lib/Drupal/Core/DrupalKernel.php, line 686

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function handleException(\Exception $e, $request, $type) {
  if ($e instanceof HttpExceptionInterface) {
    $response = new Response($e->getMessage(), $e->getStatusCode());
    $response->headers->add($e->getHeaders());
    return $response;
  }
  else {
    throw $e;
  }
}
doc_Drupal
2016-10-29 09:03:02
Comments
Leave a Comment

Please login to continue.