protected function getPreparedResponse(
        ?ServerRequestInterface $request,
        Throwable $exception,
        Throwable $transformed
    ): ResponseInterface {
        try {
            $response = $this->getResponse(
                $request,
                $exception,
                $transformed
            );
        } catch (Throwable $exception) {
            $this->report($exception);

            $response = $this->responseFactory->createResponse();
            $response = $response->withStatus(500, HttpStatus::getReasonPhrase(500));
            $response = $response->withHeader('content-type', 'text/plain');
        }

        return $response;
    }
protected function getPreparedResponse(
        ?ServerRequestInterface $request,
        Throwable $exception,
        Throwable $transformed
    ): ResponseInterface {
        try {
            $response = $this->getResponse(
                $request,
                $exception,
                $transformed
            );
        } catch (Throwable $exception) {
            $this->report($exception);

            $response = $this->responseFactory->createResponse();
            $response = $response->withStatus(500, HttpStatus::getReasonPhrase(500));
            $response = $response->withHeader('content-type', 'text/plain');
        }

        return $response;
    }
protected function getPreparedResponse ( ? ServerRequestInterface $ request , Throwable $ exception , Throwable $ transformed ) : ResponseInterface { try { $ response = $ this -> getResponse ( $ request , $ exception , $ transformed ) ; } catch ( Throwable $ exception ) { $ this -> report ( $ exception ) ; $ response = $ this -> responseFactory -> createResponse ( ) ; $ response = $ response -> withStatus ( 500 , HttpStatus :: getReasonPhrase ( 500 ) ) ; $ response = $ response -> withHeader ( 'content-type' , 'text/plain' ) ; } return $ response ; }
Get a prepared response with the transformed exception.

@param null|\Psr\Http\Message\ServerRequestInterface $request
@param \Throwable                                    $exception
@param \Throwable                                    $transformed

@return \Psr\Http\Message\ResponseInterface
Get a prepared response with the transformed exception .