diff options
author | Jaime van Kessel <nallath@gmail.com> | 2020-01-06 17:17:20 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2020-01-06 17:17:20 +0300 |
commit | 116ea76fbb7284c2d87ca6cd2437baba07e62c18 (patch) | |
tree | 7ec77c6db541b37ef1d12e03dce4b5c719ed1378 /plugins/SentryLogger | |
parent | 5083a46c0417feaff7f97b1d8ed46f6bec7fbe57 (diff) |
Don't register SentryLogger if sentry_sdk is not available
Diffstat (limited to 'plugins/SentryLogger')
-rw-r--r-- | plugins/SentryLogger/SentryLogger.py | 5 | ||||
-rw-r--r-- | plugins/SentryLogger/__init__.py | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/plugins/SentryLogger/SentryLogger.py b/plugins/SentryLogger/SentryLogger.py index 8367cfc26e..c1555133fd 100644 --- a/plugins/SentryLogger/SentryLogger.py +++ b/plugins/SentryLogger/SentryLogger.py @@ -3,7 +3,10 @@ from UM.Logger import LogOutput from typing import Set -from sentry_sdk import add_breadcrumb +try: + from sentry_sdk import add_breadcrumb +except ModuleNotFoundError: + pass from typing import Optional import os diff --git a/plugins/SentryLogger/__init__.py b/plugins/SentryLogger/__init__.py index c464de5fd4..16288bb1b3 100644 --- a/plugins/SentryLogger/__init__.py +++ b/plugins/SentryLogger/__init__.py @@ -1,6 +1,11 @@ # Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. from typing import TYPE_CHECKING, Dict, Any +try: + import sentry_sdk + has_sentry = True +except ModuleNotFoundError: + has_sentry = False from . import SentryLogger @@ -13,4 +18,6 @@ def getMetaData() -> Dict[str, Any]: def register(app: "Application") -> Dict[str, Any]: + if not has_sentry: + return {} # Nothing to do here! return {"logger": SentryLogger.SentryLogger()} |