Add some error handling for connection saving.

This commit is contained in:
Aldo Cortesi 2010-02-24 16:47:34 +13:00
parent 146a8c6d7c
commit 8eb8814387
1 changed files with 8 additions and 5 deletions

View File

@ -266,11 +266,14 @@ class ConnectionView(urwid.WidgetWrap):
else:
c = self.flow.response
path = os.path.expanduser(path)
f = file(path, "w")
f.write(str(c.headers))
f.write("\r\n")
f.write(str(c.content))
f.close()
try:
f = file(path, "w")
f.write(str(c.headers))
f.write("\r\n")
f.write(str(c.content))
f.close()
except IOError, v:
self.master.statusbar.message(str(v))
def edit(self, part):
if self.viewing == self.REQ: