Source code for mitmproxy.exceptions

"""
We try to be very hygienic regarding the exceptions we throw:
Every Exception mitmproxy raises shall be a subclass of ProxyException.


See also: http://lucumr.pocoo.org/2014/10/16/on-error-handling/
"""
from __future__ import (absolute_import, print_function, division)


[docs]class ProxyException(Exception): """ Base class for all exceptions thrown by mitmproxy. """ def __init__(self, message=None): super(ProxyException, self).__init__(message)
[docs]class ProtocolException(ProxyException): pass
[docs]class TlsProtocolException(ProtocolException): pass
[docs]class ClientHandshakeException(TlsProtocolException): def __init__(self, message, server): super(ClientHandshakeException, self).__init__(message) self.server = server
[docs]class Socks5ProtocolException(ProtocolException): pass
[docs]class HttpProtocolException(ProtocolException): pass
[docs]class ServerException(ProxyException): pass
[docs]class ContentViewException(ProxyException): pass
[docs]class ReplayException(ProxyException): pass
[docs]class ScriptException(ProxyException): pass