feat(subsonic): make error codes match Open Subsonic spec (#671)
There were a number of error codes being returned that did not match the the code given by the spec. Primarily this was the use of error code 10 (missing input parameter) when 70 (data not found) was the more appropriate return. Though several uses of 10 are actually 0 (internal server or unspecified error). Signed-off-by: Eric B Munson <eric@munsonfam.org>
This commit is contained in:
No files matched your search
@@ -82,7 +82,7 @@ func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *s
|
||||
|
||||
reader, err := coverFor(c.dbc, c.artistInfoCache, c.playlistStore, c.tagReader, id)
|
||||
if err != nil {
|
||||
return spec.NewError(10, "couldn't find cover %q: %v", id, err)
|
||||
return spec.NewError(70, "couldn't find cover %q: %v", id, err)
|
||||
}
|
||||
defer reader.Close()
|
||||
|
||||
@@ -107,7 +107,7 @@ func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *s
|
||||
resized := imaging.Fit(img, minSize, minSize, imaging.Lanczos)
|
||||
|
||||
if err := imaging.Save(resized, cachePath); err != nil {
|
||||
return spec.NewError(10, "saving cover %q: %v", id, err)
|
||||
return spec.NewError(0, "saving cover %q: %v", id, err)
|
||||
}
|
||||
|
||||
serve(cachePath)
|
||||
|
||||
Reference in New Issue
Block a user