aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamoilenko Roman <ttahabatt@gmail.com>2018-01-14 22:54:43 +0200
committerMaximilian Hils <git@maximilianhils.com>2018-01-14 21:54:43 +0100
commit2d07678fe5e7b3001462cbc15ff1fd5042259532 (patch)
treee222d9a02a59a318810504e95ef96d97af8bdb30
parent6b22da6a34f9ab4809bac5d2c940a23e165012ee (diff)
downloadmitmproxy-2d07678fe5e7b3001462cbc15ff1fd5042259532.tar.gz
mitmproxy-2d07678fe5e7b3001462cbc15ff1fd5042259532.tar.bz2
mitmproxy-2d07678fe5e7b3001462cbc15ff1fd5042259532.zip
Fix #2765 (#2792)
-rw-r--r--mitmproxy/addons/view.py3
-rw-r--r--test/mitmproxy/addons/test_view.py4
2 files changed, 6 insertions, 1 deletions
diff --git a/mitmproxy/addons/view.py b/mitmproxy/addons/view.py
index c3fb4b88..e87daf35 100644
--- a/mitmproxy/addons/view.py
+++ b/mitmproxy/addons/view.py
@@ -365,7 +365,8 @@ class View(collections.Sequence):
self.add([i.copy()])
except IOError as e:
ctx.log.error(e.strerror)
- return
+ except exceptions.FlowReadException as e:
+ ctx.log.error(str(e))
@command.command("view.go")
def go(self, dst: int) -> None:
diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py
index a95d059d..6f2a9ca5 100644
--- a/test/mitmproxy/addons/test_view.py
+++ b/test/mitmproxy/addons/test_view.py
@@ -179,6 +179,10 @@ def test_load(tmpdir):
v.load_file("nonexistent_file_path")
except IOError:
assert False
+ with open(path, "wb") as f:
+ f.write(b"invalidflows")
+ v.load_file(path)
+ assert tctx.master.has_log("Invalid data format.")
def test_resolve():