Add a --no-crash-dialog debug option.

This commit is contained in:
Florian Bruhin 2014-12-06 00:39:33 +01:00
parent 7b79b23899
commit 4829aee767
2 changed files with 17 additions and 10 deletions

View File

@ -460,16 +460,6 @@ class Application(QApplication):
"""
# pylint: disable=broad-except
if exctype is bdb.BdbQuit or not issubclass(exctype, Exception):
# pdb exit, KeyboardInterrupt, ...
try:
self.shutdown()
return
except Exception:
log.init.exception("Error while shutting down")
self.quit()
return
exc = (exctype, excvalue, tb)
if not self._quit_status['crash']:
@ -478,6 +468,21 @@ class Application(QApplication):
return
log.misc.error("Uncaught exception", exc_info=exc)
is_ignored_exception = (exctype is bdb.BdbQuit or
not issubclass(exctype, Exception))
if is_ignored_exception or self._args.no_crash_dialog:
# pdb exit, KeyboardInterrupt, ...
status = 0 if is_ignored_exception else 2
try:
self.shutdown(status)
return
except Exception:
log.init.exception("Error while shutting down")
self.quit()
return
self._quit_status['crash'] = False
try:

View File

@ -70,6 +70,8 @@ def get_argparser():
"the main window.")
debug.add_argument('--debug-exit', help="Turn on debugging of late exit.",
action='store_true')
debug.add_argument('--no-crash-dialog', action='store_true', help="Don't "
"show a crash dialog.")
# For the Qt args, we use store_const with const=True rather than
# store_true because we want the default to be None, to make
# utils.qt:get_args easier.