convert third-party exception to ConnectionError

fixes bug #1207635

Change-Id: I37da522e812286e72706409b8a6d4652515f720f
This commit is contained in:
Christian Berendt 2013-08-06 11:59:34 +02:00
parent 55b2161c8f
commit c95e59f510
2 changed files with 7 additions and 1 deletions

@ -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))

@ -39,6 +39,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):