protected function DrupalKernel::handleException in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::handleException()
- 10 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::handleException()
Converts an exception into a response.
Parameters
\Exception $e: An exception
\Symfony\Component\HttpFoundation\Request $request: A Request instance
int $type: The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
Return value
\Symfony\Component\HttpFoundation\Response A Response instance
Throws
\Exception If the passed in exception cannot be turned into a response.
2 calls to DrupalKernel::handleException()
- DrupalKernel::handle in core/
lib/ Drupal/ Core/ DrupalKernel.php - Handles a Request to convert it to a Response.
- UpdateKernel::handle in core/
lib/ Drupal/ Core/ Update/ UpdateKernel.php - Handles a Request to convert it to a Response.
File
- core/
lib/ Drupal/ Core/ DrupalKernel.php, line 742
Class
- DrupalKernel
- The DrupalKernel class is the core of Drupal itself.
Namespace
Drupal\CoreCode
protected function handleException(\Exception $e, $request, $type) {
if ($this
->shouldRedirectToInstaller($e, $this->container ? $this->container
->get('database') : NULL)) {
return new RedirectResponse($request
->getBasePath() . '/core/install.php', 302, [
'Cache-Control' => 'no-cache',
]);
}
if ($e instanceof HttpExceptionInterface) {
$response = new Response($e
->getMessage(), $e
->getStatusCode());
$response->headers
->add($e
->getHeaders());
return $response;
}
throw $e;
}