JamesReviewsMusic
JRM-5Return 404 instead of 500 for unknown album and artist IDs
Description
A few lookups don't handle the not-found case and crash instead of returning a proper 404:
AlbumService.getAlbumByID(backend/src/api/services/albumService.ts) casts the DB result toReviewedAlbumwithout checking it exists, then dereferences it. Any unknown album ID in the URL gives a 500 and a stack trace in the logs.deleteAlbumandupdateAlbumReviewalready do this check properly, so match those.ArtistService.updateArtistHeadersandupdateArtistImagesbuild[await getArtistBySpotifyID(id)]when given a single spotifyID. If the artist doesn't exist that's[undefined], and the loop crashes partway through the job. Check the lookup result and 404 before starting.
Sub-tickets
0No sub-tickets yet.
Links
No links.
Comments
0No comments yet.