diff --git a/src/common/models/robot.go b/src/common/models/robot.go index f5e9f585e..78c4d21b8 100644 --- a/src/common/models/robot.go +++ b/src/common/models/robot.go @@ -53,11 +53,7 @@ type RobotReq struct { // Valid put request validation func (rq *RobotReq) Valid(v *validation.Validation) { - switch rq.Disabled { - case true, false: - default: - v.SetError("disabled", "must be in [true, false]") - } + // ToDo: add validation for access info. } // RobotRep ... diff --git a/src/core/api/robot.go b/src/core/api/robot.go index 436cecb76..7e2ba2b91 100644 --- a/src/core/api/robot.go +++ b/src/core/api/robot.go @@ -45,13 +45,13 @@ func (r *RobotAPI) Prepare() { pid, err := r.GetInt64FromPath(":pid") if err != nil || pid <= 0 { - text := "invalid project ID: " + var errMsg string if err != nil { - text += err.Error() + errMsg = "failed to get project ID " + err.Error() } else { - text += fmt.Sprintf("%d", pid) + errMsg = "invalid project ID: " + fmt.Sprintf("%d", pid) } - r.HandleBadRequest(text) + r.HandleBadRequest(errMsg) return } project, err := r.ProjectMgr.Get(pid) @@ -137,7 +137,7 @@ func (r *RobotAPI) List() { count, err := dao.CountRobot(&query) if err != nil { - r.HandleInternalServerError(fmt.Sprintf("failed to count robots %v", err)) + r.HandleInternalServerError(fmt.Sprintf("failed to list robots on project: %d, %v", r.project.ProjectID, err)) return } query.Page, query.Size = r.GetPaginationParams()