configuration: improved error message when config file is missing
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user