summary refs log tree commit diff
path: root/synapse/config/metrics.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-02-25 13:45:58 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-02-25 13:45:58 +0000
commitc5d6fcc94909a3bedfcc6dc2158f5ca2b22a730b (patch)
treeb13c6d7af73b70ef5d8ff57c238e9b6bd1a473e0 /synapse/config/metrics.py
parentFix existing v2 identity server calls (MSC2140) (#6013) (diff)
parentCheck dependencies on setup in the nicer way. (#5989) (diff)
downloadsynapse-c5d6fcc94909a3bedfcc6dc2158f5ca2b22a730b.tar.xz
Check dependencies on setup in the nicer way. (#5989)
Diffstat (limited to 'synapse/config/metrics.py')
-rw-r--r--synapse/config/metrics.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/synapse/config/metrics.py b/synapse/config/metrics.py

index 653b990e67..9eb1e55ddb 100644 --- a/synapse/config/metrics.py +++ b/synapse/config/metrics.py
@@ -16,11 +16,9 @@ import attr -from ._base import Config, ConfigError +from synapse.python_dependencies import DependencyException, check_requirements -MISSING_SENTRY = """Missing sentry-sdk library. This is required to enable sentry - integration. - """ +from ._base import Config, ConfigError @attr.s @@ -51,9 +49,9 @@ class MetricsConfig(Config): self.sentry_enabled = "sentry" in config if self.sentry_enabled: try: - import sentry_sdk # noqa F401 - except ImportError: - raise ConfigError(MISSING_SENTRY) + check_requirements("sentry") + except DependencyException as e: + raise ConfigError(e.message) self.sentry_dsn = config["sentry"].get("dsn") if not self.sentry_dsn: