chore: Fix error handling in Config.py when checking for changes and first config saved

This commit is contained in:
Théophile Diot 2024-07-11 16:41:38 +01:00
parent 39c97a0d67
commit c4d8a308b1
No known key found for this signature in database
GPG key ID: FA995104A0BA376A

View file

@ -80,9 +80,15 @@ class Config:
i = 0
while i < 60:
curr_changes = self._db.check_changes()
first_config_saved = self._db.is_first_config_saved()
if isinstance(curr_changes, str):
if not startup:
self.__logger.error(f"An error occurred when checking for changes in the database : {curr_changes}")
elif isinstance(first_config_saved, str):
if not startup:
self.__logger.error(f"An error occurred when checking if the first config is saved in the database : {first_config_saved}")
elif not first_config_saved:
self.__logger.warning("First configuration is not saved yet, retrying in 5 seconds ...")
elif not any(curr_changes.values()):
break
else: