Skip to content

Commit

Permalink
Handle Unauthorized being returned by GQL
Browse files Browse the repository at this point in the history
  • Loading branch information
DevilXD committed Aug 2, 2024
1 parent 59de7a7 commit 9779d7a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions twitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,7 @@ async def gql_request(
response_list = [response_json]
force_retry: bool = False
for response_json in response_list:
# GQL errors handling
if "errors" in response_json:
for error_dict in response_json["errors"]:
if (
Expand All @@ -1348,6 +1349,11 @@ async def gql_request(
break
else:
raise MinerException(f"GQL error: {response_json['errors']}")
# Other error handling
elif "error" in response_json:
raise MinerException(
f"GQL error: {response_json['error']}: {response_json['message']}"
)
if force_retry:
break
else:
Expand Down

0 comments on commit 9779d7a

Please sign in to comment.