From 3f647bb561aea751fd925bcb58f52622fb2733c9 Mon Sep 17 00:00:00 2001 From: alemidev Date: Mon, 18 Apr 2022 20:43:48 +0200 Subject: [PATCH] try/except validate, refresh, login --- src/aiocraft/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aiocraft/client.py b/src/aiocraft/client.py index fcf1a67..852c2df 100644 --- a/src/aiocraft/client.py +++ b/src/aiocraft/client.py @@ -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