Sentry error handling if DSN fail

This commit is contained in:
Zeecka
2025-12-31 16:26:10 +01:00
parent 5c5e63dbea
commit 531bdc9d81
+5
View File
@@ -25,6 +25,7 @@ def initialize_sentry() -> None:
if not SENTRY_DSN or sentry_sdk.Hub.current.client is not None:
return
try:
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[
@@ -40,3 +41,7 @@ def initialize_sentry() -> None:
send_default_pii=False,
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}")