Improve Twitch's 5XXX errors handling
This commit is contained in:
1 parent
03eb64171c
commit
29be8bd799
1 file changed
+18
-6
@@ -362,15 +362,27 @@ class _AuthState:
|
|||||||
token_kind = "authy"
|
token_kind = "authy"
|
||||||
gui_print(_("login", "twofa_code_required"))
|
gui_print(_("login", "twofa_code_required"))
|
||||||
continue
|
continue
|
||||||
elif error_code == 5027:
|
elif error_code >= 5000:
|
||||||
# client blocked from this operation - use chrome
|
# Special errors, usually from Twitch telling the user to "go away"
|
||||||
logger.debug("5027: Client blocked from this operation")
|
# We print the code out to inform the user, and just use chrome flow instead
|
||||||
|
# {
|
||||||
|
# "error_code":5023,
|
||||||
|
# "error":"Please update your app to continue",
|
||||||
|
# "error_description":"client is not supported for this feature"
|
||||||
|
# }
|
||||||
|
# {
|
||||||
|
# "error_code":5027,
|
||||||
|
# "error":"Please update your app to continue",
|
||||||
|
# "error_description":"client blocked from this operation"
|
||||||
|
# }
|
||||||
|
gui_print(f"Login error code: {error_code}")
|
||||||
|
logger.debug(str(login_response))
|
||||||
use_chrome = True
|
use_chrome = True
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
msg = str(login_response["error"])
|
ext_msg = str(login_response)
|
||||||
logger.debug(msg)
|
logger.debug(ext_msg)
|
||||||
raise LoginException(msg)
|
raise LoginException(ext_msg)
|
||||||
# Success handling
|
# Success handling
|
||||||
if "access_token" in login_response:
|
if "access_token" in login_response:
|
||||||
self.access_token = cast(str, login_response["access_token"])
|
self.access_token = cast(str, login_response["access_token"])
|
||||||
|
|||||||
Reference in new issue
Block a user