aboutsummaryrefslogtreecommitdiff
path: root/urllib3/exceptions.py
diff options
context:
space:
mode:
authorSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:19:39 -0700
committerSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:19:39 -0700
commit0f393d00b51bc54c5075447e4a8b21f0bed6acd8 (patch)
tree401c9f6c345c8ec7818e2d3341086a1b889b3bc4 /urllib3/exceptions.py
parent73be7d6cc85a90ab4f67ffc27dc7eae672f7741f (diff)
downloadpython-urllib3-0f393d00b51bc54c5075447e4a8b21f0bed6acd8.tar
python-urllib3-0f393d00b51bc54c5075447e4a8b21f0bed6acd8.tar.gz
Imported Upstream version 1.9
Diffstat (limited to 'urllib3/exceptions.py')
-rw-r--r--urllib3/exceptions.py37
1 files changed, 25 insertions, 12 deletions
diff --git a/urllib3/exceptions.py b/urllib3/exceptions.py
index b4df831..fff8bfa 100644
--- a/urllib3/exceptions.py
+++ b/urllib3/exceptions.py
@@ -1,9 +1,3 @@
-# urllib3/exceptions.py
-# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
-#
-# This module is part of urllib3 and is released under
-# the MIT License: http://www.opensource.org/licenses/mit-license.php
-
## Base Exceptions
@@ -11,6 +5,11 @@ class HTTPError(Exception):
"Base exception used by this module."
pass
+class HTTPWarning(Warning):
+ "Base warning used by this module."
+ pass
+
+
class PoolError(HTTPError):
"Base exception for errors caused within a pool."
@@ -44,16 +43,20 @@ class ProxyError(HTTPError):
pass
-class ConnectionError(HTTPError):
- "Raised when a normal connection fails."
+class DecodeError(HTTPError):
+ "Raised when automatic decoding based on Content-Type fails."
pass
-class DecodeError(HTTPError):
- "Raised when automatic decoding based on Content-Type fails."
+class ProtocolError(HTTPError):
+ "Raised when something unexpected happens mid-request/response."
pass
+#: Renamed to ProtocolError but aliased for backwards compatibility.
+ConnectionError = ProtocolError
+
+
## Leaf Exceptions
class MaxRetryError(RequestError):
@@ -64,7 +67,7 @@ class MaxRetryError(RequestError):
message = "Max retries exceeded with url: %s" % url
if reason:
- message += " (Caused by %s: %s)" % (type(reason), reason)
+ message += " (Caused by %r)" % reason
else:
message += " (Caused by redirect)"
@@ -116,7 +119,12 @@ class ClosedPoolError(PoolError):
pass
-class LocationParseError(ValueError, HTTPError):
+class LocationValueError(ValueError, HTTPError):
+ "Raised when there is something wrong with a given URL input."
+ pass
+
+
+class LocationParseError(LocationValueError):
"Raised when get_host or similar fails to parse the URL input."
def __init__(self, location):
@@ -124,3 +132,8 @@ class LocationParseError(ValueError, HTTPError):
HTTPError.__init__(self, message)
self.location = location
+
+
+class InsecureRequestWarning(HTTPWarning):
+ "Warned when making an unverified HTTPS request."
+ pass