Use the Logger to report uncaught exceptions

Makes for a nicer and clearer output of uncaught exceptions
This commit is contained in:
Arjen Hiemstra 2016-06-10 14:56:08 +02:00
parent 0aea7bdb5c
commit 44f8744c84

View file

@ -5,6 +5,8 @@ import webbrowser
from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QCoreApplication
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QTextEdit
from UM.Logger import Logger
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
@ -13,7 +15,10 @@ def show(exception_type, value, tb):
if QCoreApplication.instance():
debug_mode = QCoreApplication.instance().getCommandLineOption("debug-mode", False)
traceback.print_exception(exception_type, value, tb)
Logger.log("c", "An uncaught exception has occurred!")
for line in traceback.format_exception(exception_type, value, tb):
for part in line.rstrip("\n").split("\n"):
Logger.log("c", part)
if not debug_mode:
return