From c95e59f51041dc01812d34a6b6e0765dc8c4d034 Mon Sep 17 00:00:00 2001 From: Christian Berendt <berendt@b1-systems.de> Date: Tue, 6 Aug 2013 11:59:34 +0200 Subject: [PATCH] convert third-party exception to ConnectionError fixes bug #1207635 Change-Id: I37da522e812286e72706409b8a6d4652515f720f --- cinderclient/client.py | 3 ++- cinderclient/exceptions.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 0c52c9cf3..9d3e0bc4d 100644 --- a/cinderclient/exceptions.py +++ b/cinderclient/exceptions.py @@ -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):