improve some error messages
This commit is contained in:
parent
f1d57487be
commit
f036713d71
@ -105,7 +105,7 @@ class _Context:
|
|||||||
try:
|
try:
|
||||||
self.config = search.Config.load()
|
self.config = search.Config.load()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise SystemExit(f"config error: {e}")
|
raise SystemExit(f"config error: {e!r}")
|
||||||
try:
|
try:
|
||||||
self.arguments = arguments_p.from_args(args)
|
self.arguments = arguments_p.from_args(args)
|
||||||
except decode.InvalidStep as e:
|
except decode.InvalidStep as e:
|
||||||
|
@ -29,7 +29,7 @@ class Realm:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load(name: str, data: typing.Any) -> Realm:
|
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")
|
domain = data.pop("domain")
|
||||||
servers = data.pop("servers").split()
|
servers = data.pop("servers").split()
|
||||||
forest_root_domain = data.pop("forest_root_domain", domain)
|
forest_root_domain = data.pop("forest_root_domain", domain)
|
||||||
@ -199,7 +199,7 @@ class Config:
|
|||||||
with open(conf_path) as f:
|
with open(conf_path) as f:
|
||||||
data = yaml.safe_load(f)
|
data = yaml.safe_load(f)
|
||||||
assert isinstance(data, dict)
|
assert isinstance(data, dict)
|
||||||
assert "realms" in data
|
assert "realms" in data, "Missing realms section in config"
|
||||||
realms_data = data.pop("realms")
|
realms_data = data.pop("realms")
|
||||||
assert isinstance(realms_data, dict)
|
assert isinstance(realms_data, dict)
|
||||||
realms = {}
|
realms = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user