This commit is contained in:
2025-02-18 06:55:47 -05:00
parent 36e191e27f
commit ed1bc29cc8
8 changed files with 54 additions and 31 deletions

View File

@ -157,8 +157,13 @@ class LastFM(FastAPI):
'errorText': 'Invalid request'
})
track_info_result: dict = await self.lastfm.get_track_info(artist=artist,
track_info_result: Optional[dict] = await self.lastfm.get_track_info(artist=artist,
track=track)
if not track_info_result:
return JSONResponse(status_code=500, content={
'err': True,
'errorText': 'Not found.',
})
if "err" in track_info_result:
raise LastFMException("Unknown error occurred: %s",
track_info_result.get('errorText', '??'))