(c *gin.Context, err error)
| 20 | ) |
| 21 | |
| 22 | func (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. |
| 50 | type GroupCreateRequest struct { |
no test coverage detected