Skip to content

Commit 10be382

Browse files
authored
ref(conduit): Add error handling around token generation (#103077)
Adding basic error handling around token generation to ensure errors are captured as warnings.
1 parent bfaacc5 commit 10be382

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/sentry/conduit/tasks.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from uuid import uuid4
66

77
import requests
8+
import sentry_sdk
89
from django.conf import settings
910
from google.protobuf.struct_pb2 import Struct
1011
from google.protobuf.timestamp_pb2 import Timestamp
@@ -36,7 +37,11 @@
3637
)
3738
def stream_demo_data(org_id: int, channel_id: str) -> None:
3839
"""Asynchronously stream data to Conduit."""
39-
token = generate_jwt(subject="demo")
40+
try:
41+
token = generate_jwt(subject="demo")
42+
except ValueError as e:
43+
sentry_sdk.capture_exception(e, level="warning")
44+
return
4045
logger.info(
4146
"conduit.stream_demo_data.started", extra={"org_id": org_id, "channel_id": channel_id}
4247
)

0 commit comments

Comments
 (0)