diff --git a/sentry_sdk/integrations/starlette.py b/sentry_sdk/integrations/starlette.py index a49f0bd67c..8e6e3eddba 100644 --- a/sentry_sdk/integrations/starlette.py +++ b/sentry_sdk/integrations/starlette.py @@ -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)