src/Service.php
protected function handleForResponseException(
        ServerRequestInterface $request,
        ResponseInterface $response,
        \Throwable $e
    ) : ResponseInterface {
        if ($e instanceof MethodNotAllowedException) {
            $handler = $this->getNotAllowedHandler();
        } elseif ($e instanceof NotFoundException) {
            $handler = $this->getNotFoundHandler();
        } elseif ($e instanceof \Exception) {
            $handler = $this->getExceptionHandler();
        } else {
            $handler = $this->getErrorHandler();
        }

        $response = $handler($request, $response, $e);

        // check if buffer is zero and add the buffer
        if (ob_get_level() === 0) {
            $this->addCreateBuffer();
        }

        return $response;
    }
protected function handleForResponseException(
        ServerRequestInterface $request,
        ResponseInterface $response,
        \Throwable $e
    ) : ResponseInterface {
        if ($e instanceof MethodNotAllowedException) {
            $handler = $this->getNotAllowedHandler();
        } elseif ($e instanceof NotFoundException) {
            $handler = $this->getNotFoundHandler();
        } elseif ($e instanceof \Exception) {
            $handler = $this->getExceptionHandler();
        } else {
            $handler = $this->getErrorHandler();
        }

        $response = $handler($request, $response, $e);

        // check if buffer is zero and add the buffer
        if (ob_get_level() === 0) {
            $this->addCreateBuffer();
        }

        return $response;
    }
protected function handleForResponseException ( ServerRequestInterface $ request , ResponseInterface $ response , \ Throwable $ e ) : ResponseInterface { if ( $ e instanceof MethodNotAllowedException ) { $ handler = $ this -> getNotAllowedHandler ( ) ; } elseif ( $ e instanceof NotFoundException ) { $ handler = $ this -> getNotFoundHandler ( ) ; } elseif ( $ e instanceof \ Exception ) { $ handler = $ this -> getExceptionHandler ( ) ; } else { $ handler = $ this -> getErrorHandler ( ) ; } $ response = $ handler ( $ request , $ response , $ e ) ; // check if buffer is zero and add the buffer if ( ob_get_level ( ) === 0 ) { $ this -> addCreateBuffer ( ) ; } return $ response ; }
Handle Response Exception

@param ServerRequestInterface $request
@param ResponseInterface $response
@param \Throwable $e

@return ResponseInterface
Handle Response Exception