|
41 | 41 | from typing import TYPE_CHECKING
|
42 | 42 |
|
43 | 43 | if TYPE_CHECKING:
|
44 |
| - from typing import Any, Callable, Generator, List, Optional |
| 44 | + from typing import Any, Callable, Generator, List, Optional, Union |
45 | 45 | from graphql import GraphQLError, GraphQLResolveInfo # type: ignore
|
46 | 46 | from strawberry.http import GraphQLHTTPResponse
|
47 |
| - from strawberry.types import ExecutionContext, ExecutionResult # type: ignore |
| 47 | + from strawberry.types import ExecutionContext, ExecutionResult, SubscriptionExecutionResult # type: ignore |
48 | 48 | from sentry_sdk._types import Event, EventProcessor
|
49 | 49 |
|
50 | 50 |
|
@@ -291,13 +291,13 @@ def _patch_execute():
|
291 | 291 | old_execute_sync = strawberry_schema.execute_sync
|
292 | 292 |
|
293 | 293 | async def _sentry_patched_execute_async(*args, **kwargs):
|
294 |
| - # type: (Any, Any) -> ExecutionResult |
| 294 | + # type: (Any, Any) -> Union[ExecutionResult, SubscriptionExecutionResult] |
295 | 295 | result = await old_execute_async(*args, **kwargs)
|
296 | 296 |
|
297 | 297 | if sentry_sdk.get_client().get_integration(StrawberryIntegration) is None:
|
298 | 298 | return result
|
299 | 299 |
|
300 |
| - if "execution_context" in kwargs and result.errors: |
| 300 | + if "execution_context" in kwargs: |
301 | 301 | scope = sentry_sdk.get_isolation_scope()
|
302 | 302 | event_processor = _make_request_event_processor(kwargs["execution_context"])
|
303 | 303 | scope.add_event_processor(event_processor)
|
|
0 commit comments