feat: normalize file path brackets in load_yaml_file function

This commit is contained in:
Sam Chau
2025-01-17 20:49:14 +10:30
parent 9b9dde0ae9
commit 94bbc81449

View File

@@ -92,6 +92,8 @@ def get_category_directory(category: str) -> str:
def load_yaml_file(file_path: str) -> Dict[str, Any]:
file_path = file_path.replace('[', '(').replace(']', ')')
if not os.path.exists(file_path):
logger.error(f"File not found: {file_path}")
raise FileNotFoundError(f"File not found: {file_path}")
@@ -100,9 +102,11 @@ def load_yaml_file(file_path: str) -> Dict[str, Any]:
with open(file_path, 'r') as f:
content = yaml.safe_load(f)
return content
except yaml.YAMLError as e:
logger.error(f"Error parsing YAML file {file_path}: {e}")
raise
except Exception as e:
logger.error(f"Unexpected error reading file {file_path}: {e}")
raise