strawberry-graphql 0.209.4__py3-none-any.whl → 0.209.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,11 +4,14 @@ from typing import (
4
4
  Callable,
5
5
  Dict,
6
6
  Generic,
7
+ List,
7
8
  Mapping,
8
9
  Optional,
9
10
  Union,
10
11
  )
11
12
 
13
+ from graphql import GraphQLError
14
+
12
15
  from strawberry import UNSET
13
16
  from strawberry.exceptions import MissingQueryError
14
17
  from strawberry.file_uploads.utils import replace_placeholders_with_files
@@ -143,6 +146,13 @@ class AsyncBaseHTTPView(
143
146
  except KeyError as e:
144
147
  raise HTTPException(400, "File(s) missing in form data") from e
145
148
 
149
+ def _handle_errors(
150
+ self, errors: List[GraphQLError], response_data: GraphQLHTTPResponse
151
+ ) -> None:
152
+ """
153
+ Hook to allow custom handling of errors, used by the Sentry Integration
154
+ """
155
+
146
156
  async def run(
147
157
  self,
148
158
  request: Request,
@@ -185,6 +195,9 @@ class AsyncBaseHTTPView(
185
195
 
186
196
  response_data = await self.process_result(request=request, result=result)
187
197
 
198
+ if result.errors:
199
+ self._handle_errors(result.errors, response_data)
200
+
188
201
  return self.create_response(
189
202
  response_data=response_data, sub_response=sub_response
190
203
  )
@@ -5,11 +5,14 @@ from typing import (
5
5
  Callable,
6
6
  Dict,
7
7
  Generic,
8
+ List,
8
9
  Mapping,
9
10
  Optional,
10
11
  Union,
11
12
  )
12
13
 
14
+ from graphql import GraphQLError
15
+
13
16
  from strawberry import UNSET
14
17
  from strawberry.exceptions import MissingQueryError
15
18
  from strawberry.file_uploads.utils import replace_placeholders_with_files
@@ -158,6 +161,13 @@ class SyncBaseHTTPView(
158
161
  operation_name=data.get("operationName"),
159
162
  )
160
163
 
164
+ def _handle_errors(
165
+ self, errors: List[GraphQLError], response_data: GraphQLHTTPResponse
166
+ ) -> None:
167
+ """
168
+ Hook to allow custom handling of errors, used by the Sentry Integration
169
+ """
170
+
161
171
  def run(
162
172
  self,
163
173
  request: Request,
@@ -200,6 +210,9 @@ class SyncBaseHTTPView(
200
210
 
201
211
  response_data = self.process_result(request=request, result=result)
202
212
 
213
+ if result.errors:
214
+ self._handle_errors(result.errors, response_data)
215
+
203
216
  return self.create_response(
204
217
  response_data=response_data, sub_response=sub_response
205
218
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.209.4
3
+ Version: 0.209.5
4
4
  Summary: A library for creating GraphQL APIs
5
5
  Home-page: https://strawberry.rocks/
6
6
  License: MIT
@@ -146,10 +146,10 @@ strawberry/flask/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
146
146
  strawberry/flask/graphiql.py,sha256=YnLRPOJRdzyG62T2TuFOqQ1WX0uiIU6xHLtOvmyBpw4,275
147
147
  strawberry/flask/views.py,sha256=GlK2zovhrcwVirl3qoacM1oHrPzVXHk7xEpKm_4wRC8,4966
148
148
  strawberry/http/__init__.py,sha256=t-Inc7JHEr1Tr_Afu9uAb042ujpYx-jEbe_gqCfuOlc,1403
149
- strawberry/http/async_base_view.py,sha256=sNnUXszBJnHzGnl4ssXoH9GhBcJzkx4_VKQIqzQ2V5M,6894
149
+ strawberry/http/async_base_view.py,sha256=iBi6L4e1rdDt83FmV5uxvr_aZHfzi5ESHrs773wnoos,7248
150
150
  strawberry/http/base.py,sha256=GkpqEJ2Xxr3G5TQVKOlOfn2dmOkv0tFBlXEp5Qbu5lY,1865
151
151
  strawberry/http/exceptions.py,sha256=4lgbMQ-UF2HHu2PczqkS1vGAcU08cEGY03FMrVvjqeA,155
152
- strawberry/http/sync_base_view.py,sha256=b6yBnrW-gzoNX3ffbk0HQlSqjhTxlXb2C0IyaXG7Y3s,6581
152
+ strawberry/http/sync_base_view.py,sha256=O_UeajSuMlJQjpQGUAFa2dhjgIEbRVK2lpm1EEjFTIc,6935
153
153
  strawberry/http/temporal_response.py,sha256=6w_Nn3CNiU54jzEQP8pwzzHhGuh7eJw7S0wIneASJT8,187
154
154
  strawberry/http/types.py,sha256=5alxKekKDASeQS0RkeJYo1CG5HKTXCSfclWPtbYOaPE,348
155
155
  strawberry/http/typevars.py,sha256=Kc2xRx3Jic7AruCtv3FOuv2hqeQQzcCLP1E53Nwmpts,207
@@ -234,8 +234,8 @@ strawberry/utils/logging.py,sha256=YGiPxfD5vC1UilPoKDP5vTHzQoF6F0lcOUGU3BWLBBo,1
234
234
  strawberry/utils/operation.py,sha256=Um-tBCPl3_bVFN2Ph7o1mnrxfxBes4HFCj6T0x4kZxE,1135
235
235
  strawberry/utils/str_converters.py,sha256=avIgPVLg98vZH9mA2lhzVdyyjqzLsK2NdBw9mJQ02Xk,813
236
236
  strawberry/utils/typing.py,sha256=OvJkJHNgS2uP5RMkj033_64B34xGlbCh0udXgsM9Ihg,13481
237
- strawberry_graphql-0.209.4.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
238
- strawberry_graphql-0.209.4.dist-info/METADATA,sha256=8iyzRQCQTuzNO8BTlZqWs09VmGTFniEmxuow_gUPaRc,7517
239
- strawberry_graphql-0.209.4.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
240
- strawberry_graphql-0.209.4.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
241
- strawberry_graphql-0.209.4.dist-info/RECORD,,
237
+ strawberry_graphql-0.209.5.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
238
+ strawberry_graphql-0.209.5.dist-info/METADATA,sha256=YXAasjEfS4CTZ68e-49ix-V-QVNY3zraJ_jUTkimSiU,7517
239
+ strawberry_graphql-0.209.5.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
240
+ strawberry_graphql-0.209.5.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
241
+ strawberry_graphql-0.209.5.dist-info/RECORD,,