From: Graham Dumpleton Date: Fri, 4 Oct 2013 06:07:11 +0000 (+1000) Subject: Translate urllib3 ProxyError into a requests ProxyError derived from ConnectionError. X-Git-Tag: v2.0.1~13^2~14^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4291f76c9939a15838feed0b64230f4197ba844b;p=services%2Fpython-requests.git Translate urllib3 ProxyError into a requests ProxyError derived from ConnectionError. --- diff --git a/requests/adapters.py b/requests/adapters.py index d557b74..7a0505b 100644 --- a/requests/adapters.py +++ b/requests/adapters.py @@ -22,8 +22,9 @@ from .packages.urllib3.exceptions import MaxRetryError from .packages.urllib3.exceptions import TimeoutError from .packages.urllib3.exceptions import SSLError as _SSLError from .packages.urllib3.exceptions import HTTPError as _HTTPError +from .packages.urllib3.exceptions import ProxyError as _ProxyError from .cookies import extract_cookies_to_jar -from .exceptions import ConnectionError, Timeout, SSLError +from .exceptions import ConnectionError, Timeout, SSLError, ProxyError from .auth import _basic_auth_str DEFAULT_POOLBLOCK = False @@ -353,6 +354,9 @@ class HTTPAdapter(BaseAdapter): except MaxRetryError as e: raise ConnectionError(e) + except _ProxyError as e: + raise ProxyError(e) + except (_SSLError, _HTTPError) as e: if isinstance(e, _SSLError): raise SSLError(e) diff --git a/requests/exceptions.py b/requests/exceptions.py index 22207e3..bc42b5f 100644 --- a/requests/exceptions.py +++ b/requests/exceptions.py @@ -27,6 +27,10 @@ class ConnectionError(RequestException): """A Connection error occurred.""" +class ProxyError(ConnectionError): + """A proxy error occurred.""" + + class SSLError(ConnectionError): """An SSL error occurred."""