try/except validate, refresh, login

This commit is contained in:
əlemi 2022-04-18 20:43:48 +02:00
parent 2030bfc97b
commit 3f647bb561
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -73,10 +73,10 @@ class MinecraftClient:
try:
await self.authenticator.validate() # will raise an exc if token is invalid
except AuthException:
if self.authenticator.refreshable:
await self._authenticator.refresh()
try:
await self.authenticator.refresh()
self.logger.warning("Refreshed Token")
else:
except AuthException:
await self.authenticator.login()
self.logger.info("Logged in")
self._authenticated = True