Wrap yaml parsing errors
This commit is contained in:
parent
5f08cff13b
commit
65226dba1a
|
@ -10,6 +10,7 @@ import yaml
|
|||
from yaml.composer import ComposerError
|
||||
|
||||
from operator_repo.exceptions import OperatorRepoException
|
||||
from yaml.parser import ParserError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -40,6 +41,8 @@ def _load_yaml_strict(path: Path) -> Any:
|
|||
return yaml.safe_load(yaml_file)
|
||||
except ComposerError:
|
||||
raise OperatorRepoException(f"{path} contains multiple yaml documents")
|
||||
except ParserError:
|
||||
raise OperatorRepoException(f"{path} is not a valid yaml document")
|
||||
|
||||
|
||||
def load_yaml(path: Path) -> Any:
|
||||
|
|
Loading…
Reference in New Issue