Make ConnectionRefused error more informative.

When the server refuses the connection the error message displayed now
lists the endpoint that refused the connection.

Fixes: bug 1043067
Change-Id: I62797106732bbb6eec8c99e491fd38850ad58ff8
This commit is contained in:
Andrew Laski
2012-09-12 09:40:04 -04:00
parent 3f67c461da
commit 8cee48b1dd
2 changed files with 57 additions and 1 deletions
+2 -1
View File
@@ -140,7 +140,8 @@ class HTTPClient(object):
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()
endpoint = self.endpoint
message = "Error communicating with %(endpoint)s %(e)s" % locals()
raise exc.CommunicationError(message=message)
body_iter = ResponseBodyIterator(resp)