diff options
-rw-r--r-- | mitmproxy/addons/script.py | 11 | ||||
-rw-r--r-- | mitmproxy/net/tcp.py | 2 |
2 files changed, 5 insertions, 8 deletions
diff --git a/mitmproxy/addons/script.py b/mitmproxy/addons/script.py index 5c0fe2de..a39ce5ce 100644 --- a/mitmproxy/addons/script.py +++ b/mitmproxy/addons/script.py @@ -155,9 +155,9 @@ class ScriptLoader: if not os.path.isfile(path): ctx.log.error('No such script: %s' % path) return - try: - mod = load_script(path) - if mod: + mod = load_script(path) + if mod: + with addonmanager.safecall(): ctx.master.addons.invoke_addon(mod, "running") ctx.master.addons.invoke_addon( mod, @@ -166,10 +166,7 @@ class ScriptLoader: ) for f in flows: for evt, arg in eventsequence.iterate(f): - with addonmanager.safecall(): - ctx.master.addons.invoke_addon(mod, evt, arg) - except exceptions.OptionsError as e: - script_error_handler(path, e, msg=str(e)) + ctx.master.addons.invoke_addon(mod, evt, arg) def configure(self, updated): if "scripts" in updated: diff --git a/mitmproxy/net/tcp.py b/mitmproxy/net/tcp.py index 23284057..2496d47c 100644 --- a/mitmproxy/net/tcp.py +++ b/mitmproxy/net/tcp.py @@ -586,7 +586,7 @@ class TCPServer: with self.handler_counter: try: self.handle_client_connection(connection, client_address) - except OSError as e: + except OSError as e: # pragma: no cover # This catches situations where the underlying connection is # closed beneath us. Syscalls on the connection object at this # point returns EINVAL. If this happens, we close the socket and |