This commit is contained in:
Jesse Bannon 2022-11-16 14:04:40 -08:00 committed by GitHub
parent 978dc36713
commit ed08b2f591
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,6 +8,9 @@ from yaml import YAMLError
from ytdl_sub.utils.exceptions import FileNotFoundException
from ytdl_sub.utils.exceptions import InvalidYamlException
from ytdl_sub.utils.logger import Logger
logger = Logger.get(name="yaml")
def load_yaml(file_path: str | Path) -> Dict:
@ -35,6 +38,7 @@ def load_yaml(file_path: str | Path) -> Dict:
with open(file_path, "r", encoding="utf-8") as file:
return yaml.safe_load(file)
except YAMLError as yaml_exception:
logger.debug(yaml_exception)
raise InvalidYamlException(
f"'{file_path}' has invalid YAML, copy-paste it into a YAML checker to find the issue."
) from yaml_exception