Updated for raise an exception

This commit is contained in:
Dimitris Zlatanidis 2023-02-27 10:19:22 +02:00
parent 19e3f48581
commit 48dea12e56

View file

@ -17,5 +17,9 @@ class Blacklist(Configs):
""" Reads the blacklist file. """
file = Path(self.etc_path, 'blacklist.toml')
if file.is_file():
try:
with open(file, 'rb') as black:
return tomli.load(black)['blacklist']['packages']
except tomli.TOMLDecodeError as error:
raise SystemExit(f"\nValueError: {error}: in the configuration file "
"'/etc/slpkg/blacklist.toml'\n")