asdf (#336)
This commit is contained in:
parent
978dc36713
commit
ed08b2f591
1 changed files with 4 additions and 0 deletions
|
|
@ -8,6 +8,9 @@ from yaml import YAMLError
|
||||||
|
|
||||||
from ytdl_sub.utils.exceptions import FileNotFoundException
|
from ytdl_sub.utils.exceptions import FileNotFoundException
|
||||||
from ytdl_sub.utils.exceptions import InvalidYamlException
|
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:
|
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:
|
with open(file_path, "r", encoding="utf-8") as file:
|
||||||
return yaml.safe_load(file)
|
return yaml.safe_load(file)
|
||||||
except YAMLError as yaml_exception:
|
except YAMLError as yaml_exception:
|
||||||
|
logger.debug(yaml_exception)
|
||||||
raise InvalidYamlException(
|
raise InvalidYamlException(
|
||||||
f"'{file_path}' has invalid YAML, copy-paste it into a YAML checker to find the issue."
|
f"'{file_path}' has invalid YAML, copy-paste it into a YAML checker to find the issue."
|
||||||
) from yaml_exception
|
) from yaml_exception
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue