Sentry error handling if DSN fail
This commit is contained in:
@@ -25,6 +25,7 @@ def initialize_sentry() -> None:
|
|||||||
if not SENTRY_DSN or sentry_sdk.Hub.current.client is not None:
|
if not SENTRY_DSN or sentry_sdk.Hub.current.client is not None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
sentry_sdk.init(
|
sentry_sdk.init(
|
||||||
dsn=SENTRY_DSN,
|
dsn=SENTRY_DSN,
|
||||||
integrations=[
|
integrations=[
|
||||||
@@ -40,3 +41,7 @@ def initialize_sentry() -> None:
|
|||||||
send_default_pii=False,
|
send_default_pii=False,
|
||||||
enable_tracing=True,
|
enable_tracing=True,
|
||||||
)
|
)
|
||||||
|
except sentry_sdk.utils.BadDsn as e:
|
||||||
|
print(f"Sentry DSN is invalid, skipping Sentry initialization: {e}")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Sentry initialization failed: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user