MCPcopy Create free account
hub / github.com/tbphp/gpt-load / handleGroupError

Method handleGroupError

internal/handler/group_handler.go:22–47  ·  view source on GitHub ↗
(c *gin.Context, err error)

Source from the content-addressed store, hash-verified

20)
21
22func (s *Server) handleGroupError(c *gin.Context, err error) bool {
23 if err == nil {
24 return false
25 }
26
27 if svcErr, ok := err.(*services.I18nError); ok {
28 if svcErr == nil {
29 return false
30 }
31 if svcErr.Template != nil {
32 response.ErrorI18nFromAPIError(c, svcErr.APIError, svcErr.MessageID, svcErr.Template)
33 } else {
34 response.ErrorI18nFromAPIError(c, svcErr.APIError, svcErr.MessageID)
35 }
36 return true
37 }
38
39 if apiErr, ok := err.(*app_errors.APIError); ok {
40 response.Error(c, apiErr)
41 return true
42 }
43
44 logrus.WithContext(c.Request.Context()).WithError(err).Error("unexpected group service error")
45 response.Error(c, app_errors.ErrInternalServer)
46 return true
47}
48
49// GroupCreateRequest defines the payload for creating a group.
50type GroupCreateRequest struct {

Callers 13

CreateGroupMethod · 0.95
ListGroupsMethod · 0.95
UpdateGroupMethod · 0.95
ReorderGroupsMethod · 0.95
DeleteGroupMethod · 0.95
GetGroupConfigOptionsMethod · 0.95
GetGroupStatsMethod · 0.95
CopyGroupMethod · 0.95
GetSubGroupsMethod · 0.95
AddSubGroupsMethod · 0.95
UpdateSubGroupWeightMethod · 0.95
DeleteSubGroupMethod · 0.95

Calls 3

ErrorI18nFromAPIErrorFunction · 0.92
ErrorFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected