chore(discover): raise_for_status on Last.fm fetches

A 4xx/5xx (rate limit / auth) now raises instead of parsing an error body;
callers already handle it (discovery per-source try/except; album fetch
returns []). Closes the last small deferred cleanup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan
2026-07-15 00:50:35 +02:00
parent 4a768b7122
commit f72d193ef7
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -31,6 +31,7 @@ class LastfmSource:
params={"method": method, "api_key": self._key, "format": "json", **params},
timeout=self._timeout,
)
res.raise_for_status() # a 4xx/5xx (rate limit, auth) → RequestException, handled by callers
return res.json()
def health(self) -> bool:
@@ -41,6 +41,7 @@ class LastfmAlbumPopularity:
"api_key": self._key, "format": "json", "limit": str(self._limit),
"autocorrect": "1",
}, timeout=self._timeout)
res.raise_for_status()
return _parse_top_albums(res.json())
except Exception: # a Last.fm outage must never abort the sweep
return []