diff --git a/cmd/dashboard/controller/ddns.go b/cmd/dashboard/controller/ddns.go index a2d5275..805a346 100644 --- a/cmd/dashboard/controller/ddns.go +++ b/cmd/dashboard/controller/ddns.go @@ -105,7 +105,7 @@ func editDDNS(c *gin.Context) error { var p model.DDNSProfile if err = singleton.DB.First(&p, id).Error; err != nil { - return newGormError("%v", err) + return fmt.Errorf("profile id %d does not exist", id) } p.Name = df.Name diff --git a/cmd/dashboard/controller/server.go b/cmd/dashboard/controller/server.go index fd0d0ce..a7571fd 100644 --- a/cmd/dashboard/controller/server.go +++ b/cmd/dashboard/controller/server.go @@ -1,6 +1,7 @@ package controller import ( + "fmt" "net/http" "strconv" @@ -36,7 +37,7 @@ func editServer(c *gin.Context) error { var s model.Server if err := singleton.DB.First(&s, id).Error; err != nil { - return newGormError("%v", err) + return fmt.Errorf("server id %d does not exist", id) } s.Name = sf.Name diff --git a/cmd/dashboard/controller/server_group.go b/cmd/dashboard/controller/server_group.go index 358ee0d..8811261 100644 --- a/cmd/dashboard/controller/server_group.go +++ b/cmd/dashboard/controller/server_group.go @@ -113,7 +113,7 @@ func newServerGroup(c *gin.Context) error { // @Param body body model.ServerGroupForm true "ServerGroupForm" // @Produce json // @Success 200 {object} model.CommonResponse[any] -// @Router /server-group/{id} [put] +// @Router /server-group/{id} [patch] func editServerGroup(c *gin.Context) error { id := c.Param("id") var sg model.ServerGroupForm @@ -122,7 +122,7 @@ func editServerGroup(c *gin.Context) error { } var sgDB model.ServerGroup if err := singleton.DB.First(&sgDB, id).Error; err != nil { - return newGormError("%v", err) + return fmt.Errorf("group id %s does not exist", id) } sgDB.Name = sg.Name