original_string: private function handleHttpException(HttpException $exception, Request $request) : Response
      {
          $response = new Response();
  
          $response->setContent($exception);
          $response->setStatusCode($exception->getStatusCode());
          $response->setHeaders($exception->getHeaders());
          $response->setHeader('Content-Type', 'text/plain');
  
          $event = new ExceptionCaughtEvent($exception, $request, $response);
          $this->eventDispatcher->dispatch(ExceptionCaughtEvent::class, $event);
  
          return $response;
      }
code: private function handleHttpException(HttpException $exception, Request $request) : Response
      {
          $response = new Response();
  
          $response->setContent($exception);
          $response->setStatusCode($exception->getStatusCode());
          $response->setHeaders($exception->getHeaders());
          $response->setHeader('Content-Type', 'text/plain');
  
          $event = new ExceptionCaughtEvent($exception, $request, $response);
          $this->eventDispatcher->dispatch(ExceptionCaughtEvent::class, $event);
  
          return $response;
      }
code_tokens: private function handleHttpException ( HttpException $ exception , Request $ request ) : Response { $ response = new Response ( ) ; $ response -> setContent ( $ exception ) ; $ response -> setStatusCode ( $ exception -> getStatusCode ( ) ) ; $ response -> setHeaders ( $ exception -> getHeaders ( ) ) ; $ response -> setHeader ( 'Content-Type' , 'text/plain' ) ; $ event = new ExceptionCaughtEvent ( $ exception , $ request , $ response ) ; $ this -> eventDispatcher -> dispatch ( ExceptionCaughtEvent :: class , $ event ) ; return $ response ; }
docstring: Converts an HttpException to a Response.
  
  @param \Brick\Http\Exception\HttpException $exception
  @param \Brick\Http\Request                 $request
  
  @return \Brick\Http\Response
docstring_tokens: Converts an HttpException to a Response .