# HG changeset patch # User Marcin Kuzminski # Date 2018-02-09 09:52:58 # Node ID 4c3d007dece7460c67fc626ab6a4fe1ce3c7ac5d # Parent 09501d595ca497f0a06886699f40bf55c7b84d8c core: properly report 502 errors for gevent and gunicorn. - gevent+gunicorn doesn't raise normal pycurl errors diff --git a/rhodecode/lib/exceptions.py b/rhodecode/lib/exceptions.py --- a/rhodecode/lib/exceptions.py +++ b/rhodecode/lib/exceptions.py @@ -132,6 +132,7 @@ class VCSServerUnavailable(HTTPBadGatewa 'Incorrect vcs.server=host:port', 'Incorrect vcs.server.protocol', ] + def __init__(self, message=''): self.explanation = 'Could not connect to VCS Server' if message: diff --git a/rhodecode/lib/vcs/client_http.py b/rhodecode/lib/vcs/client_http.py --- a/rhodecode/lib/vcs/client_http.py +++ b/rhodecode/lib/vcs/client_http.py @@ -197,6 +197,13 @@ def _remote_call(url, payload, exception response = session.post(url, data=msgpack.packb(payload)) except pycurl.error as e: raise exceptions.HttpVCSCommunicationError(e) + except Exception as e: + message = getattr(e, 'message', '') + if 'Failed to connect' in message: + # gevent doesn't return proper pycurl errors + raise exceptions.HttpVCSCommunicationError(e) + else: + raise if response.status_code >= 400: log.error('Call to %s returned non 200 HTTP code: %s',