diff --git a/cura/CrashHandler.py b/cura/CrashHandler.py index 4efcfbe1e5..e86e407902 100644 --- a/cura/CrashHandler.py +++ b/cura/CrashHandler.py @@ -10,6 +10,17 @@ from UM.Logger import Logger from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") +# List of exceptions that should be considered "fatal" and abort the program. +# These are primarily some exception types that we simply cannot really recover from +# (MemoryError and SystemError) and exceptions that indicate grave errors in the +# code that cause the Python interpreter to fail (SyntaxError, ImportError). +fatal_exception_types = [ + MemoryError, + SyntaxError, + ImportError, + SystemError, +] + def show(exception_type, value, tb): debug_mode = False if QCoreApplication.instance(): @@ -20,7 +31,7 @@ def show(exception_type, value, tb): for part in line.rstrip("\n").split("\n"): Logger.log("c", part) - if not debug_mode: + if not debug_mode and exception_type not in fatal_exception_types: return application = QCoreApplication.instance() @@ -34,7 +45,7 @@ def show(exception_type, value, tb): label = QLabel(dialog) layout.addWidget(label) - label.setText(catalog.i18nc("@label", "
An uncaught exception has occurred!
Please use the information below to post a bug report at http://github.com/Ultimaker/Cura/issues
")) + label.setText(catalog.i18nc("@label", "A fatal exception has occurred that we could not recover from!
Please use the information below to post a bug report at http://github.com/Ultimaker/Cura/issues
")) textarea = QTextEdit(dialog) layout.addWidget(textarea)