log error when failing to connect to Hub

for better diagnosis
This commit is contained in:
Min RK
2017-08-20 10:03:52 +02:00
parent 4b5fa404fc
commit cba5bb1676

View File

@@ -243,7 +243,8 @@ class HubAuth(Configurable):
headers.setdefault('Authorization', 'token %s' % self.api_token)
try:
r = requests.request(method, url, **kwargs)
except requests.ConnectionError:
except requests.ConnectionError as e:
self.log.error("Error connecting to %s: %s", self.api_url, e)
msg = "Failed to connect to Hub API at %r." % self.api_url
msg += " Is the Hub accessible at this URL (from host: %s)?" % socket.gethostname()
if '127.0.0.1' in self.api_url: