private static function createException(RequestInterface $request,
        ResponseInterface $altered,
        \Exception $previous = null,
        array $ctx = []
    ) {
        if ($altered->getStatusCode() >= 400 && $altered->getStatusCode() < 500) {
            return new ClientException($request, $altered, $previous, $ctx);
        }

        return new ServerException($request, $altered, $previous, $ctx);
    }
private static function createException(RequestInterface $request,
        ResponseInterface $altered,
        \Exception $previous = null,
        array $ctx = []
    ) {
        if ($altered->getStatusCode() >= 400 && $altered->getStatusCode() < 500) {
            return new ClientException($request, $altered, $previous, $ctx);
        }

        return new ServerException($request, $altered, $previous, $ctx);
    }
private static function createException ( RequestInterface $ request , ResponseInterface $ altered , \ Exception $ previous = null , array $ ctx = [ ] ) { if ( $ altered -> getStatusCode ( ) >= 400 && $ altered -> getStatusCode ( ) < 500 ) { return new ClientException ( $ request , $ altered , $ previous , $ ctx ) ; } return new ServerException ( $ request , $ altered , $ previous , $ ctx ) ; }
Create a client or server exception.

@param RequestInterface  $request
@param ResponseInterface $altered
@param \Exception        $previous
@param array             $ctx

@return ClientException|ServerException
Create a client or server exception .