protected function createJsonResponseForException(UserException $exception)
    {
        $message = $exception->getMessage();
        $statusCode = $exception->getStatusCode();
        $content = ['error' => str_replace('"', '\'', $message)];

        return new JsonResponse($content, $statusCode);
    }
protected function createJsonResponseForException(UserException $exception)
    {
        $message = $exception->getMessage();
        $statusCode = $exception->getStatusCode();
        $content = ['error' => str_replace('"', '\'', $message)];

        return new JsonResponse($content, $statusCode);
    }
protected function createJsonResponseForException ( UserException $ exception ) { $ message = $ exception -> getMessage ( ) ; $ statusCode = $ exception -> getStatusCode ( ) ; $ content = [ 'error' => str_replace ( '"' , '\'' , $ message ) ] ; return new JsonResponse ( $ content , $ statusCode ) ; }
Create JsonResponse for Exception.

@param UserException $exception

@return JsonResponse
Create JsonResponse for Exception .