Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjen Hiemstra <ahiemstra@heimr.nl>2016-06-10 16:07:59 +0300
committerArjen Hiemstra <ahiemstra@heimr.nl>2016-06-10 16:08:16 +0300
commita4e37d9ae7e2fc04dcee1558018cbc2aaa88a393 (patch)
tree693c42a75ca9dd14c44565bdca5041456f950115 /cura/CrashHandler.py
parent44f8744c847c5a8a466c75247c61c969742299bc (diff)
Mark certain types of exceptions as fatal and abort the application if they occur
We simply cannot recover properly from things like an uncaught MemoryError since that usually means any follow up operation will also fail. So Instead of silently ignoring it and having the application in a broken state we properly abort. Right now the list of fatal exceptions is a bare minimum that contains the most prominent things we cannot recover from.
Diffstat (limited to 'cura/CrashHandler.py')
-rw-r--r--cura/CrashHandler.py15
1 files changed, 13 insertions, 2 deletions
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", "<p>An uncaught exception has occurred!</p><p>Please use the information below to post a bug report at <a href=\"http://github.com/Ultimaker/Cura/issues\">http://github.com/Ultimaker/Cura/issues</a></p>"))
+ label.setText(catalog.i18nc("@label", "<p>A fatal exception has occurred that we could not recover from!</p><p>Please use the information below to post a bug report at <a href=\"http://github.com/Ultimaker/Cura/issues\">http://github.com/Ultimaker/Cura/issues</a></p>"))
textarea = QTextEdit(dialog)
layout.addWidget(textarea)