Skip to content

Commit

Permalink
fix(subsonic): return error code 70 for not found errors in more places
Browse files Browse the repository at this point in the history
fixes #454
  • Loading branch information
sentriz committed Jan 14, 2024
1 parent e978716 commit 42dbfa7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions server/ctrlsubsonic/handlers_by_tags.go
Expand Up @@ -120,7 +120,7 @@ func (c *Controller) ServeGetAlbum(r *http.Request) *spec.Response {
First(album, id.Value).
Error
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.Album = spec.NewAlbumByTags(album, album.Artists)
Expand Down Expand Up @@ -649,7 +649,7 @@ func (c *Controller) ServeGetSimilarSongs(r *http.Request) *spec.Response {
First(&track).
Error
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)
Expand Down Expand Up @@ -715,7 +715,7 @@ func (c *Controller) ServeGetSimilarSongsTwo(r *http.Request) *spec.Response {
First(&artist).
Error
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)
Expand Down
2 changes: 1 addition & 1 deletion server/ctrlsubsonic/handlers_common.go
Expand Up @@ -278,7 +278,7 @@ func (c *Controller) ServeGetSong(r *http.Request) *spec.Response {
First(&track).
Error
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", ""))
Expand Down

0 comments on commit 42dbfa7

Please sign in to comment.