diff --git a/scripts/scraper/retrodeck_scraper.py b/scripts/scraper/retrodeck_scraper.py index 40fb6bf7b..97d05acac 100644 --- a/scripts/scraper/retrodeck_scraper.py +++ b/scripts/scraper/retrodeck_scraper.py @@ -448,11 +448,14 @@ class Scraper(BaseScraper): mf = d / "component_manifest.json" if not mf.exists(): continue + # Skipped with a warning, an unreadable manifest left its + # component's systems out of retrodeck.yml, exit code 0, where + # the remote read stops. try: with open(mf) as f: manifests.append((d.name, json.load(f))) - except (json.JSONDecodeError, OSError) as e: - print(f" WARNING: {mf}: {e}", file=sys.stderr) + except json.JSONDecodeError as e: + raise ValueError(f"{mf}: not JSON: {e}") from e return manifests def component_file(self, path: str) -> str | None: diff --git a/tests/test_scraper_dropped.py b/tests/test_scraper_dropped.py index f28c7ebce..989793a96 100644 --- a/tests/test_scraper_dropped.py +++ b/tests/test_scraper_dropped.py @@ -52,6 +52,14 @@ class RetrodeckConflicts(unittest.TestCase): scraper.fetch_requirements() self.assertEqual(scraper.dropped, []) + def test_an_unreadable_local_manifest_stops_the_scrape(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + folder = Path(tmp) / "np2kai" + folder.mkdir() + (folder / "component_manifest.json").write_text("{") + with self.assertRaises(ValueError): + retrodeck_scraper.Scraper(manifests_dir=tmp).fetch_requirements() + class RommUnmappedSlug(unittest.TestCase): def test_an_unmapped_slug_fails_the_scrape(self) -> None: