mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
Be stricter about the handler call signature
Uses this to catch an error in mitmweb
This commit is contained in:
parent
735bbe52e1
commit
0042653498
@ -161,7 +161,13 @@ NO_REPLY = object()
|
||||
def handler(f):
|
||||
@functools.wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
message = args[-1]
|
||||
if len(args) == 1:
|
||||
message = args[0]
|
||||
elif len(args) == 2:
|
||||
message = args[1]
|
||||
else:
|
||||
raise ControlError("Handler takes one argument: a message")
|
||||
|
||||
if not hasattr(message, "reply"):
|
||||
raise ControlError("Message %s has no reply attribute"%message)
|
||||
|
||||
|
@ -211,7 +211,6 @@ class WebMaster(flow.FlowMaster):
|
||||
super(WebMaster, self).handle_error(f)
|
||||
self._process_flow(f)
|
||||
|
||||
@controller.handler
|
||||
def add_event(self, e, level="info"):
|
||||
super(WebMaster, self).add_event(e, level)
|
||||
self.state.add_event(e, level)
|
||||
|
Loading…
Reference in New Issue
Block a user