From 9779d7a2c8f2e5e72a16fbf0094142c932f9f796 Mon Sep 17 00:00:00 2001 From: DevilXD <4180725+DevilXD@users.noreply.github.com> Date: Fri, 2 Aug 2024 21:15:13 +0200 Subject: [PATCH] Handle Unauthorized being returned by GQL --- twitch.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/twitch.py b/twitch.py index f29fd3c6..daf0fb70 100644 --- a/twitch.py +++ b/twitch.py @@ -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 ( @@ -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: