refactor: update exception constants to follow new naming convention

- Update old ErrorStatus, ErrorType, and Service/Endpoint constants to new naming convention
- Fix incorrect TypeSpecific usage in JWT middleware
- Add missing event specific error definitions to specific.yaml
- Regenerate exception constants

Co-authored-by: Gemini <gemini@google.com>
This commit is contained in:
2026-01-21 14:31:03 +08:00
parent b1c78dce28
commit 14f50ecdb2
12 changed files with 236 additions and 229 deletions

View File

@@ -18,10 +18,10 @@ func List(c *gin.Context) {
offset, ok := c.GetQuery("offset")
if !ok {
errorCode := new(exception.Builder).
SetStatus(exception.ErrorStatusClient).
SetService(exception.UserService).
SetEndpoint(exception.UserListEndpoint).
SetType(exception.ErrorTypeCommon).
SetStatus(exception.StatusClient).
SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceList).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorInvalidInput).
Build()
utils.HttpResponse(c, 400, errorCode)
@@ -32,10 +32,10 @@ func List(c *gin.Context) {
limitNum, err := strconv.ParseInt(limit, 10, 64)
if err != nil {
errorCode := new(exception.Builder).
SetStatus(exception.ErrorStatusClient).
SetService(exception.UserService).
SetEndpoint(exception.UserListEndpoint).
SetType(exception.ErrorTypeCommon).
SetStatus(exception.StatusClient).
SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceList).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorInvalidInput).
Build()
utils.HttpResponse(c, 400, errorCode)
@@ -44,10 +44,10 @@ func List(c *gin.Context) {
offsetNum, err := strconv.ParseInt(offset, 10, 64)
if err != nil {
errorCode := new(exception.Builder).
SetStatus(exception.ErrorStatusClient).
SetService(exception.UserService).
SetEndpoint(exception.UserListEndpoint).
SetType(exception.ErrorTypeCommon).
SetStatus(exception.StatusClient).
SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceList).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorInvalidInput).
Build()
utils.HttpResponse(c, 400, errorCode)
@@ -58,10 +58,10 @@ func List(c *gin.Context) {
list, err := new(data.User).FastListUsers(limitNum, offsetNum)
if err != nil {
errorCode := new(exception.Builder).
SetStatus(exception.ErrorStatusServer).
SetService(exception.UserService).
SetEndpoint(exception.UserListEndpoint).
SetType(exception.ErrorTypeSpecific).
SetStatus(exception.StatusServer).
SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceList).
SetType(exception.TypeSpecific).
SetOriginal(exception.UserListMeilisearchFailed).
Build()
utils.HttpResponse(c, 500, errorCode)