diff --git a/app/main.py b/app/main.py index d478a2c..9c123da 100644 --- a/app/main.py +++ b/app/main.py @@ -162,7 +162,7 @@ async def _fetch_source_username( ) -> tuple[str, tuple[dict[str, int], bool] | Exception]: try: return username, await _fetch_with_cache(cache, key, fetcher) - except Exception as exc: + except (GitHubSourceError, GiteaSourceError) as exc: return username, exc diff --git a/tests/test_main.py b/tests/test_main.py index c25f8f3..f71e0fb 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -65,6 +65,25 @@ async def test_fetch_source_usernames_skips_failed_accounts() -> None: assert stale is False +@pytest.mark.asyncio +async def test_fetch_source_usernames_does_not_swallow_programming_errors() -> None: + def broken_fetcher(username): + async def fetch(): + raise TypeError("bad shape") + + return fetch + + with pytest.raises(TypeError, match="bad shape"): + await _fetch_source_usernames( + None, + "github", + ["octocat", "hubot"], + date(2026, 1, 1), + date(2026, 1, 1), + broken_fetcher, + ) + + @pytest.mark.asyncio async def test_fetch_source_usernames_keeps_cache_after_username_list_changes() -> None: with tempfile.TemporaryDirectory(dir=Path.cwd()) as temp_dir: