Skip to content

Commit

Permalink
Merge pull request #2009 from Remi-Gau/fix/2008
Browse files Browse the repository at this point in the history
[FIX] graceful error when failing to load invalid yml
  • Loading branch information
effigies authored Dec 17, 2024
2 parents 00917e6 + 76ccc4d commit 448b37d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ plugins:
- css/watermark.css
- macros:
module_name: tools/mkdocs_macros_bids/main
on_error_fail: true
- redirects:
redirect_maps:
"01-introduction.md": "introduction.md"
Expand Down
5 changes: 4 additions & 1 deletion tools/schemacode/src/bidsschematools/types/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ def _read_yaml_dir(path: Path) -> dict:
if subpath.is_dir():
mapping[subpath.name] = _read_yaml_dir(subpath)
elif subpath.name.endswith("yaml"):
mapping[subpath.stem] = yaml.safe_load(subpath.read_text())
try:
mapping[subpath.stem] = yaml.safe_load(subpath.read_text())
except Exception as e:
raise ValueError(f"There was an error reading the file: {subpath}") from e
return mapping


Expand Down

0 comments on commit 448b37d

Please sign in to comment.