Skip to content

Commit

Permalink
Handle non-int exc.status_code in starlette (#2075)
Browse files Browse the repository at this point in the history
  • Loading branch information
sentrivana committed May 4, 2023
1 parent a0f11e5 commit 81afcea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sentry_sdk/integrations/starlette.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ async def _sentry_patched_exception_handler(self, *args, **kwargs):
exp = args[0]

is_http_server_error = (
hasattr(exp, "status_code") and exp.status_code >= 500
hasattr(exp, "status_code")
and isinstance(exp.status_code, int)
and exp.status_code >= 500
)
if is_http_server_error:
_capture_exception(exp, handled=True)
Expand Down

0 comments on commit 81afcea

Please sign in to comment.