Skip to content

Commit 870be27

Browse files
author
Abhishek Shekhar
committed
Remove unnecessary code
1 parent 31beed8 commit 870be27

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

gql/transport/aiohttp.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ async def execute(
152152
# If we upload files, we will extract the files present in the
153153
# variable_values dict and replace them by null values
154154
nulled_variable_values, files = extract_files(
155-
variables=variable_values,
156-
file_classes=self.file_classes,
155+
variables=variable_values, file_classes=self.file_classes,
157156
)
158157

159158
# Save the nulled variable values in the payload
@@ -222,10 +221,6 @@ async def execute(
222221
result_text = await resp.text()
223222
log.info("<<< %s", result_text)
224223
except ClientResponseError as e:
225-
226-
# Check if the received response text is json pareable
227-
# use the parsed text or str(e) as the exception message
228-
229224
raise TransportServerError(str(e), e.status) from e
230225
except Exception:
231226
result_text = await resp.text()

gql/transport/requests.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import json
22
import logging
3-
from json.decoder import JSONDecodeError
43
from typing import Any, Dict, Optional, Union
54

65
import requests
@@ -167,20 +166,7 @@ def execute( # type: ignore
167166
if log.isEnabledFor(logging.INFO):
168167
log.info("<<< %s", response.text)
169168
except requests.HTTPError as e:
170-
171-
# Check if the received response text is json pareable
172-
# use the parsed text or str(e) as the exception message
173-
174-
try:
175-
message = response.json()
176-
if "errors" in "message":
177-
return ExecutionResult(
178-
errors=message.get("errors"), data=message.get("data")
179-
)
180-
except JSONDecodeError:
181-
message = str(e)
182-
183-
raise TransportServerError(message, e.response.status_code) from e
169+
raise TransportServerError(str(e), e.response.status_code) from e
184170
except Exception:
185171
raise TransportProtocolError("Server did not return a GraphQL result")
186172

0 commit comments

Comments
 (0)