From b642b4870b9dee7fff608c599d82f38a87556d00 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 8 Feb 2014 14:15:19 +1300 Subject: Better response when mitmproxy crashes. --- libmproxy/console/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libmproxy/console') diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py index d92561f2..24b3ddae 100644 --- a/libmproxy/console/__init__.py +++ b/libmproxy/console/__init__.py @@ -1,5 +1,5 @@ import mailcap, mimetypes, tempfile, os, subprocess, glob, time, shlex, stat -import os.path, sys, weakref +import os.path, sys, weakref, traceback import urwid from .. import controller, utils, flow, script import flowlist, flowview, help, common, grideditor, palettes, contentview, flowdetailview @@ -591,7 +591,12 @@ class ConsoleMaster(flow.FlowMaster): print >> sys.stderr, "Could not load file:", ret sys.exit(1) - self.ui.run_wrapper(self.loop) + try: + self.ui.run_wrapper(self.loop) + except Exception: + print >> sys.stderr, traceback.format_exc() + print >> sys.stderr, "mitmproxy has crashed!" + print >> sys.stderr, "Please lodge a bug report at: https://github.com/mitmproxy/mitmproxy" # If True, quit just pops out to flow list view. print >> sys.stderr, "Shutting down..." sys.stderr.flush() -- cgit v1.2.3