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/__init__.py | |
parent | 5083a46c0417feaff7f97b1d8ed46f6bec7fbe57 (diff) |
Don't register SentryLogger if sentry_sdk is not available
Diffstat (limited to 'plugins/SentryLogger/__init__.py')
-rw-r--r-- | plugins/SentryLogger/__init__.py | 7 |
1 files changed, 7 insertions, 0 deletions
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()} |