diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-09-15 19:12:15 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-09-15 19:12:15 +0200 |
commit | 11e7f476bd4bbcd6d072fa3659f628ae3a19705d (patch) | |
tree | 7fe3f67bcf41af6c573e312ef4e6adfa18f9f870 /netlib/exceptions.py | |
parent | 2f9c566e480c377566a0ae044d698a75b45cd54c (diff) | |
download | mitmproxy-11e7f476bd4bbcd6d072fa3659f628ae3a19705d.tar.gz mitmproxy-11e7f476bd4bbcd6d072fa3659f628ae3a19705d.tar.bz2 mitmproxy-11e7f476bd4bbcd6d072fa3659f628ae3a19705d.zip |
wip
Diffstat (limited to 'netlib/exceptions.py')
-rw-r--r-- | netlib/exceptions.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/netlib/exceptions.py b/netlib/exceptions.py new file mode 100644 index 00000000..637be3df --- /dev/null +++ b/netlib/exceptions.py @@ -0,0 +1,31 @@ +""" +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 |