Skip to content

Commit 50d2dae

Browse files
committed
Raise if the integration was not enabled before setup_once is called
1 parent a9d5099 commit 50d2dae

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sentry_sdk/integrations/launchdarkly.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@ def __init__(self, ld_client=None):
4040
@staticmethod
4141
def setup_once():
4242
# type: () -> None
43+
integration = sentry_sdk.get_client().get_integration(LaunchDarklyIntegration)
44+
if integration is None:
45+
raise DidNotEnable("LaunchDarkly client is not initialized.")
46+
4347
scope = sentry_sdk.get_current_scope()
4448
scope.add_error_processor(flag_error_processor)
45-
4649
# Register the flag collection hook with the LD client.
47-
client = sentry_sdk.get_client().get_integration(LaunchDarklyIntegration).client
48-
client.add_hook(LaunchDarklyHook())
50+
integration.client.add_hook(LaunchDarklyHook())
4951

5052

5153
class LaunchDarklyHook(Hook):

0 commit comments

Comments
 (0)