Handle nonexistent load files gracefully.

Also improve IOError statusbar messages.
This commit is contained in:
Aldo Cortesi 2011-01-27 15:20:07 +13:00
parent edab82f7d8
commit 96e714a74c
2 changed files with 7 additions and 5 deletions

View File

@ -295,7 +295,7 @@ class ConnectionView(WWrap):
f.write(str(c.content))
f.close()
except IOError, v:
self.master.statusbar.message(str(v))
self.master.statusbar.message(v.strerror)
def edit(self, part):
if self.viewing == self.REQ:
@ -772,7 +772,7 @@ class ConsoleMaster(controller.Master):
f.write(data)
f.close()
except IOError, v:
self.statusbar.message(str(v))
self.statusbar.message(v.strerror)
def save_one_flow(self, path, flow):
data = flow.dump()
@ -791,8 +791,7 @@ class ConsoleMaster(controller.Master):
data = f.read()
f.close()
except IOError, v:
self.statusbar.message(str(v))
return
return v.strerror
self.state.load_flows(data, ConsoleFlow)
if self.conn_list_view:
self.conn_list_view.set_focus(0)

View File

@ -80,7 +80,10 @@ if __name__ == '__main__':
m = console.ConsoleMaster(server, options)
for i in args:
m.load_flows(i)
msg = m.load_flows(i)
if msg:
print >> sys.stderr, msg
sys.exit(1)
m.run()