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;
    }
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;
    }
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 ; }
Converts an HttpException to a Response.

@param \Brick\Http\Exception\HttpException $exception
@param \Brick\Http\Request                 $request

@return \Brick\Http\Response
Converts an HttpException to a Response .