Skip to content

Commit 9df2b21

Browse files
feat(strawberry): Support Strawberry 0.239.2 (#3491)
Update our Strawberry integration to support the latest versions of Strawberry, following upstream breaking changes which caused our tests to fail. Closes #3490 Co-authored-by: Ivana Kellyer <[email protected]>
1 parent cd15bff commit 9df2b21

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sentry_sdk/integrations/strawberry.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
from typing import TYPE_CHECKING
4242

4343
if TYPE_CHECKING:
44-
from typing import Any, Callable, Generator, List, Optional
44+
from typing import Any, Callable, Generator, List, Optional, Union
4545
from graphql import GraphQLError, GraphQLResolveInfo # type: ignore
4646
from strawberry.http import GraphQLHTTPResponse
47-
from strawberry.types import ExecutionContext, ExecutionResult # type: ignore
47+
from strawberry.types import ExecutionContext, ExecutionResult, SubscriptionExecutionResult # type: ignore
4848
from sentry_sdk._types import Event, EventProcessor
4949

5050

@@ -291,13 +291,13 @@ def _patch_execute():
291291
old_execute_sync = strawberry_schema.execute_sync
292292

293293
async def _sentry_patched_execute_async(*args, **kwargs):
294-
# type: (Any, Any) -> ExecutionResult
294+
# type: (Any, Any) -> Union[ExecutionResult, SubscriptionExecutionResult]
295295
result = await old_execute_async(*args, **kwargs)
296296

297297
if sentry_sdk.get_client().get_integration(StrawberryIntegration) is None:
298298
return result
299299

300-
if "execution_context" in kwargs and result.errors:
300+
if "execution_context" in kwargs:
301301
scope = sentry_sdk.get_isolation_scope()
302302
event_processor = _make_request_event_processor(kwargs["execution_context"])
303303
scope.add_event_processor(event_processor)
@@ -309,7 +309,7 @@ def _sentry_patched_execute_sync(*args, **kwargs):
309309
# type: (Any, Any) -> ExecutionResult
310310
result = old_execute_sync(*args, **kwargs)
311311

312-
if "execution_context" in kwargs and result.errors:
312+
if "execution_context" in kwargs:
313313
scope = sentry_sdk.get_isolation_scope()
314314
event_processor = _make_request_event_processor(kwargs["execution_context"])
315315
scope.add_event_processor(event_processor)

0 commit comments

Comments
 (0)