mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-03 06:56:44 +01:00
Updated exceptions
This commit is contained in:
parent
d922f42e37
commit
c4ffa63fdb
2 changed files with 7 additions and 6 deletions
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
Loading…
Reference in a new issue