Less verbose exception logging

This commit is contained in:
Florian Bruhin 2014-06-02 23:29:01 +02:00
parent 2286d1d65a
commit 6d50ebae49

View File

@ -452,9 +452,6 @@ class QuteBrowser(QApplication):
""" """
# pylint: disable=broad-except # pylint: disable=broad-except
exc = (exctype, excvalue, tb)
sys.__excepthook__(*exc)
if exctype is BdbQuit or not issubclass(exctype, Exception): if exctype is BdbQuit or not issubclass(exctype, Exception):
# pdb exit, KeyboardInterrupt, ... # pdb exit, KeyboardInterrupt, ...
try: try:
@ -462,6 +459,10 @@ class QuteBrowser(QApplication):
return return
except Exception: except Exception:
self.quit() self.quit()
return
exc = (exctype, excvalue, tb)
sys.__excepthook__(*exc)
self._quit_status['crash'] = False self._quit_status['crash'] = False
@ -483,7 +484,7 @@ class QuteBrowser(QApplication):
try: try:
self.lastWindowClosed.disconnect(self.shutdown) self.lastWindowClosed.disconnect(self.shutdown)
except TypeError: except TypeError:
log.destroy.exception("Preventing shutdown failed.") log.destroy.warning("Preventing shutdown failed.")
QApplication.closeAllWindows() QApplication.closeAllWindows()
self._crashdlg = ExceptionCrashDialog(pages, history, exc) self._crashdlg = ExceptionCrashDialog(pages, history, exc)
ret = self._crashdlg.exec_() ret = self._crashdlg.exec_()
@ -590,35 +591,35 @@ class QuteBrowser(QApplication):
try: try:
self.config.save() self.config.save()
except AttributeError: except AttributeError:
log.destroy.exception("Could not save config.") log.destroy.warning("Could not save config.")
# Save command history # Save command history
try: try:
self.cmd_history.save() self.cmd_history.save()
except AttributeError: except AttributeError:
log.destroy.exception("Could not save command history.") log.destroy.warning("Could not save command history.")
# Save window state # Save window state
try: try:
self._save_geometry() self._save_geometry()
self.stateconfig.save() self.stateconfig.save()
except AttributeError: except AttributeError:
log.destroy.exception("Could not save window geometry.") log.destroy.warning("Could not save window geometry.")
# Save cookies # Save cookies
try: try:
self.cookiejar.save() self.cookiejar.save()
except AttributeError: except AttributeError:
log.destroy.exception("Could not save cookies.") log.destroy.warning("Could not save cookies.")
# Save quickmarks # Save quickmarks
try: try:
quickmarks.save() quickmarks.save()
except AttributeError: except AttributeError:
log.destroy.exception("Could not save quickmarks.") log.destroy.warning("Could not save quickmarks.")
# Shut down tabs # Shut down tabs
try: try:
self.mainwindow.tabs.shutdown_complete.connect(partial( self.mainwindow.tabs.shutdown_complete.connect(partial(
self._maybe_quit, 'tabs')) self._maybe_quit, 'tabs'))
self.mainwindow.tabs.shutdown() self.mainwindow.tabs.shutdown()
except AttributeError: # mainwindow or tabs could still be None except AttributeError: # mainwindow or tabs could still be None
log.destroy.exception("No mainwindow/tabs to shut down.") log.destroy.warning("No mainwindow/tabs to shut down.")
self._maybe_quit('tabs') self._maybe_quit('tabs')
# Shut down networkmanager # Shut down networkmanager
try: try:
@ -627,7 +628,7 @@ class QuteBrowser(QApplication):
self._maybe_quit, 'networkmanager')) self._maybe_quit, 'networkmanager'))
self.networkmanager.deleteLater() self.networkmanager.deleteLater()
except AttributeError: except AttributeError:
log.destroy.exception("No networkmanager to shut down.") log.destroy.warning("No networkmanager to shut down.")
self._maybe_quit('networkmanager') self._maybe_quit('networkmanager')
if self._crashlogfile is not None: if self._crashlogfile is not None:
# Re-enable faulthandler to stdout, then remove crash log # Re-enable faulthandler to stdout, then remove crash log