(c *gin.Context, err error)
| 86 | } |
| 87 | |
| 88 | func toSkillAdminErrorResponse(c *gin.Context, err error) { |
| 89 | if err == nil { |
| 90 | return |
| 91 | } |
| 92 | |
| 93 | switch { |
| 94 | case errors.Is(err, service.ErrSkillImportRequestInvalid), |
| 95 | errors.Is(err, service.ErrSkillStatusInvalid), |
| 96 | errors.Is(err, service.ErrSkillPublishPrecheckFailed), |
| 97 | errors.Is(err, service.ErrSkillGroupInvalid), |
| 98 | errors.Is(err, service.ErrSkillPermissionGroupsInvalid), |
| 99 | errors.Is(err, service.ErrSkillNameInvalid), |
| 100 | errors.Is(err, service.ErrSkillNameDuplicated), |
| 101 | errors.Is(err, service.ErrSkillAIGenerationTypeInvalid), |
| 102 | errors.Is(err, service.ErrSkillAIGenerationDocRequired), |
| 103 | errors.Is(err, service.ErrSkillImportSourceTypeUnsupported): |
| 104 | c.JSON(http.StatusBadRequest, model.ParamError.ToErrorResponse(err)) |
| 105 | case errors.Is(err, service.ErrSkillPlatformReadonly): |
| 106 | c.JSON(http.StatusForbidden, model.AuthFailed.ToErrorResponse(err)) |
| 107 | case errors.Is(err, gorm.ErrRecordNotFound): |
| 108 | c.JSON(http.StatusNotFound, model.NotFound.ToResponse(nil)) |
| 109 | default: |
| 110 | c.JSON(http.StatusInternalServerError, model.DBError.ToErrorResponse(err)) |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | func parseCommaSeparatedInt64IDs(input string) []int64 { |
| 115 | parts := strings.Split(input, ",") |
no test coverage detected