Gracefully handle invalid data format passed to -r flag.

This commit is contained in:
Aldo Cortesi 2012-02-09 12:09:40 +13:00
parent d3dce8f943
commit 46bd780862
2 changed files with 8 additions and 2 deletions

View File

@ -640,7 +640,10 @@ class ConsoleMaster(flow.FlowMaster):
fr = flow.FlowReader(f)
except IOError, v:
return v.strerror
flow.FlowMaster.load_flows(self, fr)
try:
flow.FlowMaster.load_flows(self, fr)
except flow.FlowReadError, v:
return v.strerror
f.close()
if self.conn_list_view:
self.sync_list_view()

View File

@ -103,7 +103,10 @@ class DumpMaster(flow.FlowMaster):
freader = flow.FlowReader(f)
except IOError, v:
raise DumpError(v.strerror)
self.load_flows(freader)
try:
self.load_flows(freader)
except flow.FlowReadError, v:
raise DumpError(v)
def _readflow(self, path):