aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/exceptions.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-16 20:19:52 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-16 20:19:52 +0200
commite1659f3fcf83b5993b776a4ef3d2de70fbe27aa2 (patch)
treec0eba50b522d1d0183b057e9cae7bf7cc38c4fc3 /netlib/exceptions.py
parent2f9c566e480c377566a0ae044d698a75b45cd54c (diff)
parent265f31e8782ee9da511ce4b63aa2da00221cbf66 (diff)
downloadmitmproxy-e1659f3fcf83b5993b776a4ef3d2de70fbe27aa2.tar.gz
mitmproxy-e1659f3fcf83b5993b776a4ef3d2de70fbe27aa2.tar.bz2
mitmproxy-e1659f3fcf83b5993b776a4ef3d2de70fbe27aa2.zip
Merge pull request #92 from mitmproxy/python3
Python3 & HTTP1 Refactor
Diffstat (limited to 'netlib/exceptions.py')
-rw-r--r--netlib/exceptions.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/netlib/exceptions.py b/netlib/exceptions.py
new file mode 100644
index 00000000..e13af473
--- /dev/null
+++ b/netlib/exceptions.py
@@ -0,0 +1,32 @@
+"""
+We try to be very hygienic regarding the exceptions we throw:
+Every Exception netlib raises shall be a subclass of NetlibException.
+
+
+See also: http://lucumr.pocoo.org/2014/10/16/on-error-handling/
+"""
+from __future__ import absolute_import, print_function, division
+
+
+class NetlibException(Exception):
+ """
+ Base class for all exceptions thrown by netlib.
+ """
+ def __init__(self, message=None):
+ super(NetlibException, self).__init__(message)
+
+
+class ReadDisconnect(object):
+ """Immediate EOF"""
+
+
+class HttpException(NetlibException):
+ pass
+
+
+class HttpReadDisconnect(HttpException, ReadDisconnect):
+ pass
+
+
+class HttpSyntaxException(HttpException):
+ pass