diff --git a/sentry_sdk/integrations/asgi.py b/sentry_sdk/integrations/asgi.py index 6983af89ed..bd17a973c0 100644 --- a/sentry_sdk/integrations/asgi.py +++ b/sentry_sdk/integrations/asgi.py @@ -183,7 +183,7 @@ async def _run_app( except Exception as exc: self._capture_lifespan_exception(exc) - raise exc from None + raise _asgi_middleware_applied.set(True) try: @@ -259,7 +259,7 @@ async def _sentry_wrapped_send( ) except Exception as exc: self._capture_request_exception(exc) - raise exc from None + raise finally: _asgi_middleware_applied.set(False)