socket errors and timeouts should be CommunicationErrors
Also include extra information about socket errors within the exceptions. Change-Id: I9464a484460d40be5727e18ca6f057df9076766e
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user