diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index c49a2942..b870f20b 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -22,7 +22,8 @@ class Blacklist(Configs): if file_toml.is_file(): try: with open(file_toml, '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") + return tomli.load(black)['BLACKLIST']['PACKAGES'] + except (tomli.TOMLDecodeError, KeyError) as error: + raise SystemExit(f"\nError: {error}: in the configuration file '/etc/slpkg/blacklist.toml'.\n" + f"\nIf you have upgraded the '{self.prog_name}' probably you need to run:\n" + f"mv {self.etc_path}/{self.prog_name}.toml.new {self.etc_path}/{self.prog_name}.toml\n") diff --git a/slpkg/configs.py b/slpkg/configs.py index 3839f5b6..5247841e 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -18,7 +18,7 @@ class LoadConfigs: with open(config_path_file, 'rb') as conf: return tomli.load(conf) except tomli.TOMLDecodeError as error: - raise SystemExit(f"\nValueError: {error}: in the configuration file " + raise SystemExit(f"\nError: {error}: in the configuration file " "'/etc/slpkg/slpkg.toml'\n") @@ -174,7 +174,7 @@ class Configs: file_pattern_conf: str = config['FILE_PATTERN'] except KeyError as error: - raise SystemExit(f"\nKeyError: {error}: in the configuration file '/etc/slpkg/slpkg.toml'.\n" + raise SystemExit(f"\nError: {error}: in the configuration file '/etc/slpkg/slpkg.toml'.\n" f"\nIf you have upgraded the '{prog_name}' probably you need to run:\n" f"mv {etc_path}/{prog_name}.toml.new {etc_path}/{prog_name}.toml\n")