improve some error messages

This commit is contained in:
Stefan Bühler 2023-05-10 16:23:32 +02:00
parent f1d57487be
commit f036713d71
2 changed files with 3 additions and 3 deletions

View File

@ -105,7 +105,7 @@ class _Context:
try:
self.config = search.Config.load()
except Exception as e:
raise SystemExit(f"config error: {e}")
raise SystemExit(f"config error: {e!r}")
try:
self.arguments = arguments_p.from_args(args)
except decode.InvalidStep as e:

View File

@ -29,7 +29,7 @@ class Realm:
@staticmethod
def load(name: str, data: typing.Any) -> Realm:
assert isinstance(data, dict)
assert isinstance(data, dict), f"Realm section isn't a dictionary: {data!r}"
domain = data.pop("domain")
servers = data.pop("servers").split()
forest_root_domain = data.pop("forest_root_domain", domain)
@ -199,7 +199,7 @@ class Config:
with open(conf_path) as f:
data = yaml.safe_load(f)
assert isinstance(data, dict)
assert "realms" in data
assert "realms" in data, "Missing realms section in config"
realms_data = data.pop("realms")
assert isinstance(realms_data, dict)
realms = {}