Skip to content

Commit

Permalink
Added validation on required configuration keys in Sentry SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
kirgrim committed Oct 3, 2024
1 parent b1acfee commit 7c7e405
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions neon_utils/log_aggregators/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 7c7e405

Please sign in to comment.