summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Behrens <cbehrens@codestud.com>2012-08-10 21:06:44 +0000
committerChris Behrens <cbehrens@codestud.com>2012-08-10 21:13:21 +0000
commita214d983c2ae115c5c4965808f2bd5912c71e4c3 (patch)
tree21f2c5e0301526ba31b4128d3b25e2a0bd759de0
parent3997f977fa0df34f72670e0e4a4e9e87d932b2af (diff)
downloadpython-glanceclient-a214d983c2ae115c5c4965808f2bd5912c71e4c3.tar.gz
socket errors and timeouts should be CommunicationErrors0.4.0
Also include extra information about socket errors within the exceptions. Change-Id: I9464a484460d40be5727e18ca6f057df9076766e
-rw-r--r--glanceclient/common/http.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py
index 6aa8f9f..e18bdf8 100644
--- a/glanceclient/common/http.py
+++ b/glanceclient/common/http.py
@@ -134,13 +134,13 @@ class HTTPClient(object):
try:
conn.request(method, url, **kwargs)
- except (socket.error, socket.gaierror):
- raise exc.InvalidEndpoint()
-
- try:
resp = conn.getresponse()
- except (socket.error, socket.timeout):
- raise exc.CommunicationError()
+ except socket.gaierror as e:
+ message = "Error finding address for %(url)s: %(e)s" % locals()
+ raise exc.InvalidEndpoint(message=message)
+ except (socket.error, socket.timeout) as e:
+ message = "Error communicating with %(url)s: %(e)s" % locals()
+ raise exc.CommunicationError(message=message)
body_iter = ResponseBodyIterator(resp)