/**
  * @param Request $request
  * @param FlattenException $exception
  * @param DebugLoggerInterface $logger
  * @return \GoIntegro\Hateoas\Http\JsonResponse
  */
 public function showAction(Request $request, FlattenException $exception, DebugLoggerInterface $logger = NULL)
 {
     $error = new ErrorObject();
     $error->status = $exception->getStatusCode();
     $error->title = $exception->getMessage();
     $error->code = $exception->getCode();
     $serializer = new ErrorSerializer($error);
     if (500 == $error->status && NULL != $logger) {
         $logger->error(sprintf(self::ERROR_LOG_MESSAGE_PATTERN, $error->title, $exception->getFile(), $exception->getLine(), $error->id));
     }
     return $this->createNoCacheResponse($serializer->serialize(), $error->status, $exception->getHeaders());
 }