fix: stop when a profile does not parse

generate_db wrote a database without the aliases of a profile it could not read, and the MAME and FBNeo refreshes passed without it. Each now names the file and exits non-zero.
This commit is contained in:
Abdessamad Derraz committed 2026-10-18 20:40:23 +02:00
1 parent 9a417dde2a
commit 89ac31780b
5 files changed
+79 -7

No files matched your search

+4 -2
View File
@@ -204,8 +204,10 @@ def _find_fbneo_profiles() -> list[Path]:
for path in source_yaml_paths(EMULATORS_DIR):
try:
data = yaml_load(path.read_text(encoding="utf-8"))
except (yaml.YAMLError, OSError):
continue
except (yaml.YAMLError, OSError) as exc:
# Skipped, a broken fbneo.yml left the list and the refresh
# reported "no matching emulator profiles found" with exit 0.
raise RuntimeError(f"cannot read {path}: {exc}") from exc
if not data or not isinstance(data, dict):
continue
upstream = data.get("upstream", "")
+4 -2
View File
@@ -216,8 +216,10 @@ def _find_mame_profiles() -> list[Path]:
and source.rstrip("/") in _MAME_TREES
):
profiles.append(path)
except (yaml.YAMLError, OSError):
continue
except (yaml.YAMLError, OSError) as exc:
# Skipped, a broken mame.yml left the list and the refresh
# reported success without touching it.
raise RuntimeError(f"cannot read {path}: {exc}") from exc
return profiles