mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 09:53:32 +01:00
Config: Make branch() throw exception on inexistent path
Config.branch(path) just silently returns the entire tree if path doesn't exist in the config. Fix that. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
91d7517054
commit
79a3696eaa
1 changed files with 6 additions and 1 deletions
|
|
@ -113,7 +113,12 @@ class Config(): # export
|
|||
|
||||
def branch(self, path: str): # type: ignore # Optional[Config]: FIXME: Don't know how to get hold of this type here
|
||||
if self.__conf:
|
||||
return Config(tree=self.__conf.get(path), parent=self) # type: ignore
|
||||
tree = self.__conf.get(path)
|
||||
if tree is None:
|
||||
msg = f'Tried to get non-existent branch "{path}" from config'
|
||||
self.dump(ERR, msg)
|
||||
throw(msg)
|
||||
return Config(tree=tree, parent=self) # type: ignore
|
||||
return None
|
||||
|
||||
def dump(self, prio: int, *args, **kwargs) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue