chore: better error message

This commit is contained in:
Florian Bezannier
2026-05-20 18:58:51 +02:00
committed by Florian BEZANNIER
parent 643b537952
commit e505a2a163
2 changed files with 7 additions and 3 deletions
+3 -2
View File
@@ -21,7 +21,7 @@ def rate_limit(limit, every):
timer.daemon = True
timer.start()
else:
raise RateLimitException
raise RateLimitException(func.__name__)
return wrapper
@@ -47,7 +47,8 @@ def parse_hour(s):
class RateLimitException(Exception):
pass
def __init__(self, func_name):
super().__init__(f"Rate limit exceeded for {func_name}")
def get_positions(locations):
+4 -1
View File
@@ -192,7 +192,10 @@ class RemoteClient:
self.remote_token_last_update = datetime.now()
self.mqtt_client.username_pw_set("IMA_OAUTH_ACCESS_TOKEN", self.remoteCredentials.access_token)
return True
except (RequestException, RateLimitException, KeyError, AttributeError, RemoteException):
except RateLimitException as e:
logger.error("Can't refresh remote token please wait... %s", e)
return False
except (RequestException, KeyError, AttributeError, RemoteException):
logger.exception("Can't refresh remote token, please redo otp procedure")
return False