private function createInternalServerError(\Exception $exception)
    {
        $message = sprintf(
            '%s: %s (uncaught exception) at %s line %s',
            get_class($exception),
            $exception->getMessage(),
            $exception->getFile(),
            $exception->getLine()
        );

        $this->logger->error($message, array('exception' => $exception));

        $response = [
            'status'  => 'ERROR',
            'message' => JsonResponse::$statusTexts[JsonResponse::HTTP_INTERNAL_SERVER_ERROR]
        ];

        if ($this->debug) {
            $response['exception'] = $this->formatException($exception);
        }

        return new JsonResponse($response, JsonResponse::HTTP_INTERNAL_SERVER_ERROR);
    }