Removing engine.ErrDataNotFound in favor of domain.ErrNotFound
This commit is contained in:
+2
-2
@@ -2,11 +2,11 @@ package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/deluan/gosonic/api/responses"
|
||||
"github.com/deluan/gosonic/domain"
|
||||
"github.com/deluan/gosonic/engine"
|
||||
"github.com/deluan/gosonic/utils"
|
||||
)
|
||||
@@ -69,7 +69,7 @@ func (c *BrowsingController) GetDirectory() {
|
||||
|
||||
dir, err := c.browser.Directory(id)
|
||||
switch {
|
||||
case err == engine.ErrDataNotFound:
|
||||
case err == domain.ErrNotFound:
|
||||
beego.Error("Requested Id", id, "not found:", err)
|
||||
c.SendError(responses.ErrorDataNotFound, "Directory not found")
|
||||
case err != nil:
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/deluan/gosonic/api/responses"
|
||||
"github.com/deluan/gosonic/domain"
|
||||
"github.com/deluan/gosonic/engine"
|
||||
"github.com/deluan/gosonic/utils"
|
||||
)
|
||||
@@ -26,9 +27,9 @@ func (c *MediaAnnotationController) Star() {
|
||||
beego.Debug("Starring ids:", ids)
|
||||
err := c.ratings.SetStar(true, ids...)
|
||||
switch {
|
||||
case err == engine.ErrDataNotFound:
|
||||
case err == domain.ErrNotFound:
|
||||
beego.Error(err)
|
||||
c.SendError(responses.ErrorDataNotFound, "Directory not found")
|
||||
c.SendError(responses.ErrorDataNotFound, "Id not found")
|
||||
case err != nil:
|
||||
beego.Error(err)
|
||||
c.SendError(responses.ErrorGeneric, "Internal Error")
|
||||
@@ -43,7 +44,7 @@ func (c *MediaAnnotationController) Unstar() {
|
||||
beego.Debug("Unstarring ids:", ids)
|
||||
err := c.ratings.SetStar(false, ids...)
|
||||
switch {
|
||||
case err == engine.ErrDataNotFound:
|
||||
case err == domain.ErrNotFound:
|
||||
beego.Error(err)
|
||||
c.SendError(responses.ErrorDataNotFound, "Directory not found")
|
||||
case err != nil:
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/deluan/gosonic/api/responses"
|
||||
"github.com/deluan/gosonic/domain"
|
||||
"github.com/deluan/gosonic/engine"
|
||||
"github.com/deluan/gosonic/utils"
|
||||
)
|
||||
@@ -37,7 +38,7 @@ func (c *MediaRetrievalController) GetCover() {
|
||||
err := c.cover.Get(id, size, c.Ctx.ResponseWriter)
|
||||
|
||||
switch {
|
||||
case err == engine.ErrDataNotFound:
|
||||
case err == domain.ErrNotFound:
|
||||
beego.Error(err, "Id:", id)
|
||||
c.SendError(responses.ErrorDataNotFound, "Directory not found")
|
||||
case err != nil:
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package api
|
||||
import (
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/deluan/gosonic/api/responses"
|
||||
"github.com/deluan/gosonic/domain"
|
||||
"github.com/deluan/gosonic/engine"
|
||||
"github.com/deluan/gosonic/utils"
|
||||
)
|
||||
@@ -42,7 +43,7 @@ func (c *PlaylistsController) Get() {
|
||||
|
||||
pinfo, err := c.pls.Get(id)
|
||||
switch {
|
||||
case err == engine.ErrDataNotFound:
|
||||
case err == domain.ErrNotFound:
|
||||
beego.Error(err, "Id:", id)
|
||||
c.SendError(responses.ErrorDataNotFound, "Directory not found")
|
||||
case err != nil:
|
||||
|
||||
Reference in New Issue
Block a user