codekingpro/portable-devtools
115k
1"""2 3Edit 2020-12 @mhils:4 The advice below hasn't paid off in any form. We now just use builtin exceptions and specialize where necessary.5 6---7 8We try to be very hygienic regarding the exceptions we throw:9 10- Every exception that might be externally visible to users shall be a subclass11 of MitmproxyException.p12- Every exception in the base net module shall be a subclass13 of NetlibException, and will not be propagated directly to users.14 15See also: http://lucumr.pocoo.org/2014/10/16/on-error-handling/16"""17 18 19class MitmproxyException(Exception):20 """21 Base class for all exceptions thrown by mitmproxy.22 """23 24 def __init__(self, message=None):25 super().__init__(message)26 27 28class FlowReadException(MitmproxyException):29 pass30 31 32class ControlException(MitmproxyException):33 pass34 35 36class CommandError(Exception):37 pass38 39 40class OptionsError(MitmproxyException):41 pass42 43 44class AddonManagerError(MitmproxyException):45 pass46 47 48class AddonHalt(MitmproxyException):49 """50 Raised by addons to signal that no further handlers should handle this event.51 """52 