mirror of
https://github.com/navidrome/navidrome.git
synced 2025-06-03 00:51:11 +03:00
Renamed error variable
This commit is contained in:
parent
42f3279aaf
commit
5fc3b3ff11
@ -68,7 +68,7 @@ func (c *BrowsingController) GetDirectory() {
|
|||||||
|
|
||||||
dir, err := c.browser.Directory(id)
|
dir, err := c.browser.Directory(id)
|
||||||
switch {
|
switch {
|
||||||
case err == engine.DataNotFound:
|
case err == engine.ErrDataNotFound:
|
||||||
beego.Error("Requested Id", id, "not found:", err)
|
beego.Error("Requested Id", id, "not found:", err)
|
||||||
c.SendError(responses.ERROR_DATA_NOT_FOUND, "Directory not found")
|
c.SendError(responses.ERROR_DATA_NOT_FOUND, "Directory not found")
|
||||||
case err != nil:
|
case err != nil:
|
||||||
|
@ -24,7 +24,7 @@ func (c *GetCoverArtController) Get() {
|
|||||||
err := c.cover.Get(id, size, c.Ctx.ResponseWriter)
|
err := c.cover.Get(id, size, c.Ctx.ResponseWriter)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case err == engine.DataNotFound:
|
case err == engine.ErrDataNotFound:
|
||||||
beego.Error(err, "Id:", id)
|
beego.Error(err, "Id:", id)
|
||||||
c.SendError(responses.ERROR_DATA_NOT_FOUND, "Directory not found")
|
c.SendError(responses.ERROR_DATA_NOT_FOUND, "Directory not found")
|
||||||
case err != nil:
|
case err != nil:
|
||||||
|
@ -40,7 +40,7 @@ func (c *PlaylistsController) Get() {
|
|||||||
|
|
||||||
pinfo, err := c.pls.Get(id)
|
pinfo, err := c.pls.Get(id)
|
||||||
switch {
|
switch {
|
||||||
case err == engine.DataNotFound:
|
case err == engine.ErrDataNotFound:
|
||||||
beego.Error(err, "Id:", id)
|
beego.Error(err, "Id:", id)
|
||||||
c.SendError(responses.ERROR_DATA_NOT_FOUND, "Directory not found")
|
c.SendError(responses.ERROR_DATA_NOT_FOUND, "Directory not found")
|
||||||
case err != nil:
|
case err != nil:
|
||||||
|
@ -78,7 +78,7 @@ func (c browser) Directory(id string) (*DirectoryInfo, error) {
|
|||||||
dir = c.buildAlbumDir(al, tracks)
|
dir = c.buildAlbumDir(al, tracks)
|
||||||
default:
|
default:
|
||||||
beego.Debug("Id", id, "not found")
|
beego.Debug("Id", id, "not found")
|
||||||
return nil, DataNotFound
|
return nil, ErrDataNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
return dir, nil
|
return dir, nil
|
||||||
|
@ -25,5 +25,5 @@ type Child struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
DataNotFound = errors.New("Data Not Found")
|
ErrDataNotFound = errors.New("Data Not Found")
|
||||||
)
|
)
|
||||||
|
@ -48,7 +48,7 @@ func (c cover) Get(id string, size int, out io.Writer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return DataNotFound
|
return ErrDataNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
if size > 0 {
|
if size > 0 {
|
||||||
|
@ -53,7 +53,7 @@ func TestCover(t *testing.T) {
|
|||||||
err := cover.Get("2", 0, out)
|
err := cover.Get("2", 0, out)
|
||||||
|
|
||||||
Convey("Then it should return DatNotFound error", func() {
|
Convey("Then it should return DatNotFound error", func() {
|
||||||
So(err, ShouldEqual, engine.DataNotFound)
|
So(err, ShouldEqual, engine.ErrDataNotFound)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
Convey("When specifying a size", func() {
|
Convey("When specifying a size", func() {
|
||||||
|
@ -35,7 +35,7 @@ func (p playlists) Get(id string) (*PlaylistInfo, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if pl == nil {
|
if pl == nil {
|
||||||
return nil, DataNotFound
|
return nil, ErrDataNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
pinfo := &PlaylistInfo{Id: pl.Id, Name: pl.Name}
|
pinfo := &PlaylistInfo{Id: pl.Id, Name: pl.Name}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user