private function displayError(Request $request,Response $response){
        $exception=$response->getContent();

        $data=array(
            'statusCode'=>$response->getStatusCode()
        ,'message'=>$exception->getMessage()
        ,'exception'=>get_class($exception)
        ,'file'=>$exception->getFile()
        ,'line'=>$exception->getLine()
        );

        if($this->environment->isDebug()){
            echo $this->twig->render('error.twig', $data);
        }
        else{
            echo $this->twig->render($response->getStatusCode().'.twig');
        }
    }