diff options
author | Brian Waldon <bcwaldon@gmail.com> | 2013-04-02 21:25:30 -0700 |
---|---|---|
committer | Brian Waldon <bcwaldon@gmail.com> | 2013-04-02 21:40:12 -0700 |
commit | dca30fbb936dfaca7f5f10ab34a67e6460b3b235 (patch) | |
tree | 21f0f1d3f3ee9aa09f5924327d1ec9eabec57a78 | |
parent | 3a3e2540ff10a78ca9b4dde98671f6fd970e6568 (diff) | |
download | python-keystoneclient-dca30fbb936dfaca7f5f10ab34a67e6460b3b235.tar.gz |
Convert requests.ConnectionError to ClientException
Fixes bug 1163678
Change-Id: I16201eda29a56e3c1e6008989260425ddc124ea6
-rw-r--r-- | keystoneclient/client.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/keystoneclient/client.py b/keystoneclient/client.py index fb5c6db..b9d4bc7 100644 --- a/keystoneclient/client.py +++ b/keystoneclient/client.py @@ -351,11 +351,16 @@ class HTTPClient(object): request_kwargs.setdefault('timeout', self.timeout) self.http_log_req((url, method,), request_kwargs) - resp = requests.request( - method, - url, - verify=self.verify_cert, - **request_kwargs) + + try: + resp = requests.request( + method, + url, + verify=self.verify_cert, + **request_kwargs) + except requests.ConnectionError: + msg = 'Unable to establish connection to %s' % url + raise exceptions.ClientException(msg) self.http_log_resp(resp) |