Skip to content

Commit a57ba7e

Browse files
authored
Resolve TypeError when raising GraphQL errors
`results.errors[0]` is a dict and raising it throws a TypeError: `TypeError: exceptions must be old-style classes or derived from BaseException, not dict` This fixes this error. Granted its not the best solution and we should probably subclass Exception to our own GQLError or something in the future. But at least it makes the current code work and provide error feedback and not a TypeError
1 parent 162b73d commit a57ba7e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gql/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def execute(self, document, *args, **kwargs):
4949

5050
result = self._get_result(document, *args, **kwargs)
5151
if result.errors:
52-
raise result.errors[0]
52+
raise Exception(str(result.errors[0]))
5353

5454
return result.data
5555

0 commit comments

Comments
 (0)