Updated for JSONDecodeError

This commit is contained in:
Dimitris Zlatanidis 2024-04-01 10:43:44 +03:00
parent da4ec2b433
commit a00966e9d5

View file

@ -49,6 +49,7 @@ class LoadData(Configs):
Returns:
Dictionary with data.
"""
json_data: dict = {}
try:
json_data: dict = json.loads(file.read_text(encoding='utf-8'))
except FileNotFoundError:
@ -57,6 +58,8 @@ class LoadData(Configs):
print('\nNeed to update the database first, please run:\n')
print(f"{'':>2} $ {self.green}slpkg update{self.endc}\n")
raise SystemExit(1)
except json.decoder.JSONDecodeError:
pass
return json_data
def _remove_blacklist_from_all_repos(self, data: dict) -> dict: