Browse Source

Merge "be more explicit about connection errors"

Jenkins 2 years ago
parent
commit
626886b4aa
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      keystoneauth1/session.py

+ 8
- 2
keystoneauth1/session.py View File

@@ -631,8 +631,14 @@ class Session(object):
631 631
             except requests.exceptions.Timeout:
632 632
                 msg = 'Request to %s timed out' % url
633 633
                 raise exceptions.ConnectTimeout(msg)
634
-            except requests.exceptions.ConnectionError:
635
-                msg = 'Unable to establish connection to %s' % url
634
+            except requests.exceptions.ConnectionError as e:
635
+                # NOTE(sdague): urllib3/requests connection error is a
636
+                # translation of SocketError. However, SocketError
637
+                # happens for many different reasons, and that low
638
+                # level message is often really important in figuring
639
+                # out the difference between network misconfigurations
640
+                # and firewall blocking.
641
+                msg = 'Unable to establish connection to %s: %s' % (url, e)
636 642
                 raise exceptions.ConnectFailure(msg)
637 643
             except requests.exceptions.RequestException as e:
638 644
                 msg = 'Unexpected exception for %(url)s: %(error)s' % {

Loading…
Cancel
Save