mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-26 17:49:15 +01:00
refactor: code cleanup
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/crawlab-team/crawlab/core/errors"
|
||||
"errors"
|
||||
models2 "github.com/crawlab-team/crawlab/core/models/models/v2"
|
||||
"github.com/crawlab-team/crawlab/core/models/service"
|
||||
"github.com/crawlab-team/crawlab/db/mongo"
|
||||
@@ -73,7 +73,7 @@ func GetProjectList(c *gin.Context) {
|
||||
for _, s := range spiders {
|
||||
_, ok := cache[s.ProjectId]
|
||||
if !ok {
|
||||
HandleErrorInternalServerError(c, errors.ErrorControllerMissingInCache)
|
||||
HandleErrorInternalServerError(c, errors.New("project id not found"))
|
||||
return
|
||||
}
|
||||
cache[s.ProjectId]++
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/crawlab-team/crawlab/core/errors"
|
||||
errors2 "errors"
|
||||
"github.com/crawlab-team/crawlab/core/models/models/v2"
|
||||
"github.com/crawlab-team/crawlab/core/models/service"
|
||||
"github.com/crawlab-team/crawlab/core/schedule"
|
||||
@@ -56,7 +56,7 @@ func PutScheduleById(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if s.Id != id {
|
||||
HandleErrorBadRequest(c, errors.ErrorHttpBadRequest)
|
||||
HandleErrorBadRequest(c, errors2.New("id in path does not match id in body"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ package controllers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
errors2 "errors"
|
||||
"github.com/crawlab-team/crawlab/core/constants"
|
||||
"github.com/crawlab-team/crawlab/core/entity"
|
||||
"github.com/crawlab-team/crawlab/core/errors"
|
||||
"github.com/crawlab-team/crawlab/core/utils"
|
||||
"github.com/crawlab-team/crawlab/db/generic"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -111,7 +111,7 @@ func GetFilterAll(c *gin.Context) (res bool, err error) {
|
||||
case "FALSE":
|
||||
return false, nil
|
||||
default:
|
||||
return false, errors.ErrorFilterInvalidOperation
|
||||
return false, errors2.New("invalid value")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user