Improve exception hierarchy
ProxyException -> MitmproxyException NetlibException inherits from MitmproxyException
This commit is contained in:
parent
01a449b5cb
commit
9491d8589a
|
@ -2,7 +2,7 @@
|
||||||
We try to be very hygienic regarding the exceptions we throw:
|
We try to be very hygienic regarding the exceptions we throw:
|
||||||
|
|
||||||
- Every exception that might be externally visible to users shall be a subclass
|
- Every exception that might be externally visible to users shall be a subclass
|
||||||
of ProxyException.p
|
of MitmproxyException.p
|
||||||
- Every exception in the base net module shall be a subclass
|
- Every exception in the base net module shall be a subclass
|
||||||
of NetlibException, and will not be propagated directly to users.
|
of NetlibException, and will not be propagated directly to users.
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ See also: http://lucumr.pocoo.org/2014/10/16/on-error-handling/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class ProxyException(Exception):
|
class MitmproxyException(Exception):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Base class for all exceptions thrown by mitmproxy.
|
Base class for all exceptions thrown by mitmproxy.
|
||||||
|
@ -20,7 +20,7 @@ class ProxyException(Exception):
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
|
|
||||||
|
|
||||||
class Kill(ProxyException):
|
class Kill(MitmproxyException):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Signal that both client and server connection(s) should be killed immediately.
|
Signal that both client and server connection(s) should be killed immediately.
|
||||||
|
@ -28,7 +28,7 @@ class Kill(ProxyException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ProtocolException(ProxyException):
|
class ProtocolException(MitmproxyException):
|
||||||
"""
|
"""
|
||||||
ProtocolExceptions are caused by invalid user input, unavailable network resources,
|
ProtocolExceptions are caused by invalid user input, unavailable network resources,
|
||||||
or other events that are outside of our influence.
|
or other events that are outside of our influence.
|
||||||
|
@ -69,48 +69,48 @@ class Http2ZombieException(ProtocolException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ServerException(ProxyException):
|
class ServerException(MitmproxyException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ContentViewException(ProxyException):
|
class ContentViewException(MitmproxyException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ReplayException(ProxyException):
|
class ReplayException(MitmproxyException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class FlowReadException(ProxyException):
|
class FlowReadException(MitmproxyException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ControlException(ProxyException):
|
class ControlException(MitmproxyException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SetServerNotAllowedException(ProxyException):
|
class SetServerNotAllowedException(MitmproxyException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class OptionsError(Exception):
|
class OptionsError(MitmproxyException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AddonError(Exception):
|
class AddonError(MitmproxyException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AddonHalt(Exception):
|
class AddonHalt(MitmproxyException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Every net Exception raised shall be a subclass of NetlibException.
|
Net-layer exceptions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class NetlibException(Exception):
|
class NetlibException(MitmproxyException):
|
||||||
"""
|
"""
|
||||||
Base class for all exceptions thrown by netlib.
|
Base class for all exceptions thrown by netlib.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -5,6 +5,7 @@ from OpenSSL import SSL
|
||||||
import netlib.tcp
|
import netlib.tcp
|
||||||
from mitmproxy import tcp
|
from mitmproxy import tcp
|
||||||
from mitmproxy import flow
|
from mitmproxy import flow
|
||||||
|
from mitmproxy import exceptions
|
||||||
from mitmproxy.proxy.protocol import base
|
from mitmproxy.proxy.protocol import base
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue