From 8eb8814387bcd827d537ec27c685bbff07d7fcdb Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 24 Feb 2010 16:47:34 +1300 Subject: Add some error handling for connection saving. --- libmproxy/console.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'libmproxy') diff --git a/libmproxy/console.py b/libmproxy/console.py index aca9ecdf..0b44e7af 100644 --- a/libmproxy/console.py +++ b/libmproxy/console.py @@ -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: -- cgit v1.2.3