diff --git a/cinderclient/client.py b/cinderclient/client.py index 857f80a03..792ffd51e 100644 --- a/cinderclient/client.py +++ b/cinderclient/client.py @@ -192,7 +192,8 @@ class HTTPClient(object): except requests.exceptions.ConnectionError as e: # Catch a connection refused from requests.request self._logger.debug("Connection refused: %s" % e) - raise + msg = 'Unable to establish connection: %s' % e + raise exceptions.ConnectionError(msg) self._logger.debug( "Failed attempt(%s of %s), retrying in %s seconds" % (attempts, self.retries, backoff)) diff --git a/cinderclient/exceptions.py b/cinderclient/exceptions.py index 55c0757b9..b84eefd6b 100644 --- a/cinderclient/exceptions.py +++ b/cinderclient/exceptions.py @@ -53,6 +53,11 @@ class EndpointNotFound(Exception): pass +class ConnectionError(Exception): + """Could not open a connection to the API service.""" + pass + + class AmbiguousEndpoints(Exception): """Found more than one matching endpoint in Service Catalog.""" def __init__(self, endpoints=None):