public function handleException($exception, $request, $response)
    {
        $renderer = $this->getRenderer($exception, $request);
        try {
            $res = $renderer->render();
            $this->logException($request, $exception);

            return $res;
        } catch (Throwable $exception) {
            $this->logException($request, $exception);
            $response = $this->handleInternalError($response);
        } catch (Exception $exception) {
            $this->logException($request, $exception);
            $response = $this->handleInternalError($response);
        }

        return $response;
    }
public function handleException($exception, $request, $response)
    {
        $renderer = $this->getRenderer($exception, $request);
        try {
            $res = $renderer->render();
            $this->logException($request, $exception);

            return $res;
        } catch (Throwable $exception) {
            $this->logException($request, $exception);
            $response = $this->handleInternalError($response);
        } catch (Exception $exception) {
            $this->logException($request, $exception);
            $response = $this->handleInternalError($response);
        }

        return $response;
    }
public function handleException ( $ exception , $ request , $ response ) { $ renderer = $ this -> getRenderer ( $ exception , $ request ) ; try { $ res = $ renderer -> render ( ) ; $ this -> logException ( $ request , $ exception ) ; return $ res ; } catch ( Throwable $ exception ) { $ this -> logException ( $ request , $ exception ) ; $ response = $ this -> handleInternalError ( $ response ) ; } catch ( Exception $ exception ) { $ this -> logException ( $ request , $ exception ) ; $ response = $ this -> handleInternalError ( $ response ) ; } return $ response ; }
Handle an exception and generate an error response

@param \Exception $exception The exception to handle.
@param \Psr\Http\Message\ServerRequestInterface $request The request.
@param \Psr\Http\Message\ResponseInterface $response The response.
@return \Psr\Http\Message\ResponseInterface A response
Handle an exception and generate an error response