diff options
author | Jaime van Kessel <nallath@gmail.com> | 2022-01-05 16:08:00 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2022-01-05 16:08:00 +0300 |
commit | 6e4143ba591d460e665dfd1ed30dd8e814ab16fd (patch) | |
tree | 35f43521bc3069e170a48ce16507a9fedbea7e8d | |
parent | ab0c03cf6598b56764169546148a1fa85f61279c (diff) | |
parent | b7357d054ba4b9b4dedb232e5981e641facd1db3 (diff) |
Merge branch '4.13' of github.com:Ultimaker/Cura
-rw-r--r-- | cura/CrashHandler.py | 11 | ||||
-rwxr-xr-x | cura/CuraApplication.py | 4 | ||||
-rw-r--r-- | plugins/SentryLogger/SentryLogger.py | 1 |
3 files changed, 14 insertions, 2 deletions
diff --git a/cura/CrashHandler.py b/cura/CrashHandler.py index db44daa77c..c911a42350 100644 --- a/cura/CrashHandler.py +++ b/cura/CrashHandler.py @@ -12,10 +12,12 @@ import json import locale from typing import cast, Any +import sentry_sdk + try: from sentry_sdk.hub import Hub from sentry_sdk.utils import event_from_exception - from sentry_sdk import configure_scope + from sentry_sdk import configure_scope, add_breadcrumb with_sentry_sdk = True except ImportError: with_sentry_sdk = False @@ -424,6 +426,13 @@ class CrashHandler: if with_sentry_sdk: try: hub = Hub.current + if not Logger.getLoggers(): + # No loggers have been loaded yet, so we don't have any breadcrumbs :( + # So add them manually so we at least have some info... + add_breadcrumb(level = "info", message = "SentryLogging was not initialised yet") + for log_type, line in Logger.getUnloggedLines(): + add_breadcrumb(message=line) + event, hint = event_from_exception((self.exception_type, self.value, self.traceback)) hub.capture_event(event, hint=hint) hub.flush() diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index ebd1708bf5..ca708709aa 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -777,10 +777,14 @@ class CuraApplication(QtApplication): lib_suffixes = {""} for suffix in lib_suffixes: self._plugin_registry.addPluginLocation(os.path.join(QtApplication.getInstallPrefix(), "lib" + suffix, "cura")) + if not hasattr(sys, "frozen"): self._plugin_registry.addPluginLocation(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "plugins")) self._plugin_registry.preloaded_plugins.append("ConsoleLogger") + # Since it's possible to get crashes in code before the sentrylogger is loaded, we want to start this plugin + # as quickly as possible, as we might get unsolvable crash reports without it. + self._plugin_registry.preloaded_plugins.append("SentryLogger") self._plugin_registry.loadPlugins() if self.getBackend() is None: diff --git a/plugins/SentryLogger/SentryLogger.py b/plugins/SentryLogger/SentryLogger.py index 29230abb1f..0a65e1e00a 100644 --- a/plugins/SentryLogger/SentryLogger.py +++ b/plugins/SentryLogger/SentryLogger.py @@ -11,7 +11,6 @@ try: except ImportError: pass from typing import Optional -import os class SentryLogger(LogOutput): |