ErrorI18nFromAPIError sends a standardized error response using an APIError with i18n message.
(c *gin.Context, apiErr *app_errors.APIError, msgID string, templateData ...map[string]any)
| 61 | |
| 62 | // ErrorI18nFromAPIError sends a standardized error response using an APIError with i18n message. |
| 63 | func ErrorI18nFromAPIError(c *gin.Context, apiErr *app_errors.APIError, msgID string, templateData ...map[string]any) { |
| 64 | message := i18n.Message(c, msgID, templateData...) |
| 65 | c.JSON(apiErr.HTTPStatus, ErrorResponse{ |
| 66 | Code: apiErr.Code, |
| 67 | Message: message, |
| 68 | }) |
| 69 | } |
no test coverage detected