Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix KeyError when errors is not iterable #359

Conversation

leszekhanusz
Copy link
Collaborator

Should fix #358

@codecov
Copy link

codecov bot commented Sep 10, 2022

Codecov Report

Merging #359 (4e16cfb) into master (5a9c0cc) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #359   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines         2243      2250    +7     
=========================================
+ Hits          2243      2250    +7     
Impacted Files Coverage Δ
gql/client.py 100.00% <100.00%> (ø)
gql/utils.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@leszekhanusz leszekhanusz merged commit e53b168 into graphql-python:master Sep 10, 2022
@leszekhanusz leszekhanusz deleted the fix_keyerror_when_errors_is_not_iterable branch November 7, 2022 21:29
@rysuds
Copy link

rysuds commented Feb 17, 2023

@leszekhanusz any chance we could bump the minor version to pull in this fix? Unfortunately my 0.3.4 is still running on the old logic and I'm hitting an error:

File ***/site-packages/gql/client.py:1232, in AsyncClientSession.execute(self, document, variable_values, operation_name, serialize_variables, parse_result, get_execution_result, **kwargs)
   1229 # Raise an error if an error is returned in the ExecutionResult object
   1230 if result.errors:
   1231     raise TransportQueryError(
-> 1232         str(result.errors[0]),
   1233         errors=result.errors,
   1234         data=result.data,
   1235         extensions=result.extensions,
   1236     )
   1238 assert (
   1239     result.data is not None
   1240 ), "Transport returned an ExecutionResult without data or errors"
   1242 if get_execution_result:

KeyError: 0

@leszekhanusz
Copy link
Collaborator Author

@rysuds No, sorry, old versions are not supported anymore.

You'll have to either use a recent version of gql (See the 3.0 release notes for breaking changes, it should be quite straightforward), or you'll have to fork your own version with only this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Client crashes on 429 HTTP response code
2 participants