Opt: server not found error string

pull/52/head
zijiren233 1 year ago
parent 1bd5e040bf
commit 4ff6cf12b7

@ -66,14 +66,14 @@ func List(ctx *gin.Context) {
return
}
if total == 0 {
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("alist server id not found"))
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("alist server not found"))
return
}
ev, err := db.GetAlistVendors(user.ID, append(socpes, db.Paginate(page, size))...)
if err != nil {
if errors.Is(err, db.ErrNotFound("vendor")) {
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("alist server id not found"))
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("alist server not found"))
return
}
ctx.AbortWithStatusJSON(http.StatusInternalServerError, model.NewApiErrorResp(err))
@ -126,7 +126,7 @@ AlistFSListResp:
aucd, err := user.AlistCache().LoadOrStore(ctx, serverID)
if err != nil {
if errors.Is(err, db.ErrNotFound("vendor")) {
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("alist server id not found"))
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("alist server not found"))
return
}

@ -27,7 +27,7 @@ func Me(ctx *gin.Context) {
aucd, err := user.AlistCache().LoadOrStore(ctx, serverID)
if err != nil {
if errors.Is(err, db.ErrNotFound("vendor")) {
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("alist server id not found"))
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("alist server not found"))
return
}
ctx.AbortWithStatusJSON(http.StatusInternalServerError, model.NewApiErrorResp(err))

@ -67,14 +67,14 @@ func List(ctx *gin.Context) {
return
}
if total == 0 {
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("emby server id not found"))
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("emby server not found"))
return
}
ev, err := db.GetEmbyVendors(user.ID, append(socpes, db.Paginate(page, size))...)
if err != nil {
if errors.Is(err, db.ErrNotFound("vendor")) {
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("emby server id not found"))
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("emby server not found"))
return
}
ctx.AbortWithStatusJSON(http.StatusInternalServerError, model.NewApiErrorResp(err))
@ -124,7 +124,7 @@ EmbyFSListResp:
aucd, err := user.EmbyCache().LoadOrStore(ctx, serverID)
if err != nil {
if errors.Is(err, db.ErrNotFound("vendor")) {
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("emby server id not found"))
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("emby server not found"))
return
}
ctx.AbortWithStatusJSON(http.StatusInternalServerError, model.NewApiErrorResp(err))

@ -27,7 +27,7 @@ func Me(ctx *gin.Context) {
eucd, err := user.EmbyCache().LoadOrStore(ctx, serverID)
if err != nil {
if errors.Is(err, db.ErrNotFound("vendor")) {
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("emby server id not found"))
ctx.JSON(http.StatusBadRequest, model.NewApiErrorStringResp("emby server not found"))
return
}
ctx.AbortWithStatusJSON(http.StatusInternalServerError, model.NewApiErrorResp(err))

Loading…
Cancel
Save