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

@@ -16,10 +16,10 @@ func Refresh(c *gin.Context) {
if err := c.ShouldBindJSON(&req); err != nil {
errorCode := new(exception.Builder).
SetStatus(exception.ErrorStatusClient).
SetService(exception.AuthService).
SetEndpoint(exception.AuthRefreshEndpoint).
SetType(exception.ErrorTypeCommon).
SetStatus(exception.StatusClient).
SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRefresh).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorInvalidInput).
Build()
utils.HttpResponse(c, 400, errorCode)
@@ -33,10 +33,10 @@ func Refresh(c *gin.Context) {
accessToken, err := JwtTool.RefreshAccessToken(req.RefreshToken)
if err != nil {
errorCode := new(exception.Builder).
SetStatus(exception.ErrorStatusClient).
SetService(exception.AuthService).
SetEndpoint(exception.AuthRefreshEndpoint).
SetType(exception.ErrorTypeSpecific).
SetStatus(exception.StatusClient).
SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRefresh).
SetType(exception.TypeSpecific).
SetOriginal(exception.AuthRefreshInvalidToken).
Build()
utils.HttpResponse(c, 401, errorCode)
@@ -46,10 +46,10 @@ func Refresh(c *gin.Context) {
refreshToken, err := JwtTool.RenewRefreshToken(req.RefreshToken)
if err != nil {
errorCode := new(exception.Builder).
SetStatus(exception.ErrorStatusServer).
SetService(exception.AuthService).
SetEndpoint(exception.AuthRefreshEndpoint).
SetType(exception.ErrorTypeSpecific).
SetStatus(exception.StatusServer).
SetService(exception.ServiceAuth).
SetEndpoint(exception.EndpointAuthServiceRefresh).
SetType(exception.TypeSpecific).
SetOriginal(exception.AuthRefreshRenewFailed).
Build()
utils.HttpResponse(c, 500, errorCode)