Skip to content

Commit 16c17c1

Browse files
committed
generic error handling
1 parent 02c42be commit 16c17c1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/sentry/integrations/jira/webhooks/installed.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sentry_sdk
22
from django.db import router, transaction
3-
from jwt import ExpiredSignatureError, InvalidKeyError, InvalidSignatureError
3+
from jwt import InvalidKeyError
44
from rest_framework import status
55
from rest_framework.request import Request
66
from rest_framework.response import Response
@@ -67,10 +67,10 @@ def post(self, request: Request, *args, **kwargs) -> Response:
6767
return self.respond(
6868
{"detail": "Invalid key id"}, status=status.HTTP_400_BAD_REQUEST
6969
)
70-
except (InvalidSignatureError, ExpiredSignatureError):
71-
lifecycle.record_halt(halt_reason="JWT contained invalid or expired signature")
70+
except Exception:
71+
lifecycle.record_halt(halt_reason="JWT authentication failed")
7272
return self.respond(
73-
{"detail": "Invalid or expired signature"}, status=status.HTTP_400_BAD_REQUEST
73+
{"detail": "JWT authentication failed"}, status=status.HTTP_400_BAD_REQUEST
7474
)
7575

7676
data = JiraIntegrationProvider().build_integration(state)

0 commit comments

Comments
 (0)