MCPcopy Index your code
hub / github.com/53AI/53AIHub / toSkillAdminErrorResponse

Function toSkillAdminErrorResponse

api/controller/skill_library_admin.go:88–112  ·  view source on GitHub ↗
(c *gin.Context, err error)

Source from the content-addressed store, hash-verified

86}
87
88func 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
114func parseCommaSeparatedInt64IDs(input string) []int64 {
115 parts := strings.Split(input, ",")

Callers 15

AdminImportSkillLibraryFunction · 0.85
AdminListSkillLibrariesFunction · 0.85
AdminGetSkillLibraryFunction · 0.85
AdminUpdateSkillLibraryFunction · 0.85
AdminDeleteSkillLibraryFunction · 0.85
GetSkillFileTreeFunction · 0.85
GetSkillFileContentFunction · 0.85
PreviewSkillFileFunction · 0.85

Calls 2

ToErrorResponseMethod · 0.80
ToResponseMethod · 0.80

Tested by

no test coverage detected