fix(subsonic): return error code 70 for not found errors in more places
fixes #454
This commit is contained in:
@@ -120,7 +120,7 @@ func (c *Controller) ServeGetAlbum(r *http.Request) *spec.Response {
|
|||||||
First(album, id.Value).
|
First(album, id.Value).
|
||||||
Error
|
Error
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
return spec.NewError(10, "couldn't find an album with that id")
|
return spec.NewError(70, "couldn't find an album with that id")
|
||||||
}
|
}
|
||||||
sub := spec.NewResponse()
|
sub := spec.NewResponse()
|
||||||
sub.Album = spec.NewAlbumByTags(album, album.Artists)
|
sub.Album = spec.NewAlbumByTags(album, album.Artists)
|
||||||
@@ -649,7 +649,7 @@ func (c *Controller) ServeGetSimilarSongs(r *http.Request) *spec.Response {
|
|||||||
First(&track).
|
First(&track).
|
||||||
Error
|
Error
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
return spec.NewError(10, "couldn't find a track with that id")
|
return spec.NewError(70, "couldn't find a track with that id")
|
||||||
}
|
}
|
||||||
|
|
||||||
similarTracks, err := c.lastFMClient.TrackGetSimilarTracks(track.TagTrackArtist, track.TagTitle)
|
similarTracks, err := c.lastFMClient.TrackGetSimilarTracks(track.TagTrackArtist, track.TagTitle)
|
||||||
@@ -715,7 +715,7 @@ func (c *Controller) ServeGetSimilarSongsTwo(r *http.Request) *spec.Response {
|
|||||||
First(&artist).
|
First(&artist).
|
||||||
Error
|
Error
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
return spec.NewError(0, "artist with id %q not found", id)
|
return spec.NewError(70, "artist with id %q not found", id)
|
||||||
}
|
}
|
||||||
|
|
||||||
similarArtists, err := c.lastFMClient.ArtistGetSimilar(artist.Name)
|
similarArtists, err := c.lastFMClient.ArtistGetSimilar(artist.Name)
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ func (c *Controller) ServeGetSong(r *http.Request) *spec.Response {
|
|||||||
First(&track).
|
First(&track).
|
||||||
Error
|
Error
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
return spec.NewError(10, "couldn't find a track with that id")
|
return spec.NewError(70, "couldn't find a track with that id")
|
||||||
}
|
}
|
||||||
|
|
||||||
transcodeMeta := streamGetTranscodeMeta(c.dbc, user.ID, params.GetOr("c", ""))
|
transcodeMeta := streamGetTranscodeMeta(c.dbc, user.ID, params.GetOr("c", ""))
|
||||||
|
|||||||
Reference in New Issue
Block a user