configuration: improved error message when config file is missing

This commit is contained in:
2024-02-07 20:44:36 +01:00
parent 15e8f8fd6b
commit 1932f8f6e9
2 changed files with 8 additions and 2 deletions
+2
View File
@@ -150,6 +150,8 @@ class Config:
@classmethod
def from_file(cls: Type[ConfigInst], path: str) -> ConfigInst:
if not Path(path).exists():
raise ConfigError(f"Configuration file '{path}' not found. Use 'cmm config --create' to create one.")
with open(path, 'r') as f:
source = yaml.load(f, Loader=yaml.FullLoader)
return cls.from_dict(source)