Skip to content

Commit

Permalink
Raise if the integration was not enabled before setup_once is called
Browse files Browse the repository at this point in the history
  • Loading branch information
cmanallen committed Oct 30, 2024
1 parent a9d5099 commit 50d2dae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sentry_sdk/integrations/launchdarkly.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ def __init__(self, ld_client=None):
@staticmethod
def setup_once():
# type: () -> None
integration = sentry_sdk.get_client().get_integration(LaunchDarklyIntegration)
if integration is None:
raise DidNotEnable("LaunchDarkly client is not initialized.")

scope = sentry_sdk.get_current_scope()
scope.add_error_processor(flag_error_processor)

# Register the flag collection hook with the LD client.
client = sentry_sdk.get_client().get_integration(LaunchDarklyIntegration).client
client.add_hook(LaunchDarklyHook())
integration.client.add_hook(LaunchDarklyHook())


class LaunchDarklyHook(Hook):
Expand Down

0 comments on commit 50d2dae

Please sign in to comment.