diff options
| author | Aldo Cortesi <aldo@nullcube.com> | 2010-02-24 16:47:34 +1300 | 
|---|---|---|
| committer | Aldo Cortesi <aldo@nullcube.com> | 2010-02-24 16:47:34 +1300 | 
| commit | 8eb8814387bcd827d537ec27c685bbff07d7fcdb (patch) | |
| tree | 485ab33537fb112ce5864b7df50f131ca1b0e42b | |
| parent | 146a8c6d7c603519f1effc3c7f1a75b1a34cd811 (diff) | |
| download | mitmproxy-8eb8814387bcd827d537ec27c685bbff07d7fcdb.tar.gz mitmproxy-8eb8814387bcd827d537ec27c685bbff07d7fcdb.tar.bz2 mitmproxy-8eb8814387bcd827d537ec27c685bbff07d7fcdb.zip | |
Add some error handling for connection saving.
| -rw-r--r-- | libmproxy/console.py | 13 | 
1 files changed, 8 insertions, 5 deletions
| 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: | 
