From 7c7e405579b0687ed4d3dd278b17d7ca5ad63ad0 Mon Sep 17 00:00:00 2001 From: kgrim Date: Thu, 3 Oct 2024 13:55:20 +0200 Subject: [PATCH] Added validation on required configuration keys in Sentry SDK --- neon_utils/log_aggregators/sentry.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/neon_utils/log_aggregators/sentry.py b/neon_utils/log_aggregators/sentry.py index 29e59220..29fecb74 100644 --- a/neon_utils/log_aggregators/sentry.py +++ b/neon_utils/log_aggregators/sentry.py @@ -28,6 +28,11 @@ import sentry_sdk +SENTRY_SDK_REQUIRED_KEYS = {'dsn'} + def init_sentry(config: dict): + missing_required_keys = SENTRY_SDK_REQUIRED_KEYS.difference(config.keys()) + if missing_required_keys: + raise KeyError(f'Sentry SDK configuration missing required keys: {missing_required_keys}') return sentry_sdk.init(**config)