public function ExceptionController::execute

Handles an exception on a request.

Parameters

Symfony\Component\HttpKernel\Exception\FlattenException $exception: The flattened exception.

Symfony\Component\HttpFoundation\Request $request: The request that generated the exception.

Return value

Symfony\Component\HttpFoundation\Response A response object to be sent to the server.

File

drupal/core/lib/Drupal/Core/Controller/ExceptionController.php, line 53
Contains \Drupal\Core\Controller\ExceptionController.

Class

ExceptionController
This controller handles HTTP errors generated by the routing system.

Namespace

Drupal\Core\Controller

Code

public function execute(FlattenException $exception, Request $request) {
  $method = 'on' . $exception
    ->getStatusCode() . $this->negotiation
    ->getContentType($request);
  if (method_exists($this, $method)) {
    return $this
      ->{$method}($exception, $request);
  }
  return new Response('A fatal error occurred: ' . $exception
    ->getMessage(), $exception
    ->getStatusCode());
}