Handles an exception on a request.
Symfony\Component\HttpKernel\Exception\FlattenException $exception: The flattened exception.
Symfony\Component\HttpFoundation\Request $request: The request that generated the exception.
Symfony\Component\HttpFoundation\Response A response object to be sent to the server.
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());
}