diff --git a/src/ytdl_sub/utils/yaml.py b/src/ytdl_sub/utils/yaml.py index 58c8d972..f0f04d5c 100644 --- a/src/ytdl_sub/utils/yaml.py +++ b/src/ytdl_sub/utils/yaml.py @@ -38,9 +38,9 @@ def load_yaml(file_path: str | Path) -> Dict: with open(file_path, "r", encoding="utf-8") as file: output = 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." + f"'{file_path}' has invalid YAML:\n{yaml_exception}\n\n" + f"Copy-pasting it into a YAML parser can also help find the issue." ) from yaml_exception if not isinstance(output, dict): diff --git a/tests/unit/utils/test_yaml.py b/tests/unit/utils/test_yaml.py index fe5f2a90..7d0fd284 100644 --- a/tests/unit/utils/test_yaml.py +++ b/tests/unit/utils/test_yaml.py @@ -69,10 +69,7 @@ def test_load_yaml_file_not_found(): def test_load_yaml_invalid_syntax(bad_yaml_file_path: str): with pytest.raises( InvalidYamlException, - match=re.escape( - f"'{bad_yaml_file_path}' has invalid YAML, " - f"copy-paste it into a YAML checker to find the issue." - ), + match=re.escape(f"'{bad_yaml_file_path}' has invalid YAML"), ): load_yaml(file_path=bad_yaml_file_path)