refactor: use SetError in exception.Builder where errors are available

Update multiple services and middlewares to pass the original error to exception.Builder before building the error code.

Co-authored-by: Gemini <gemini@google.com>
This commit is contained in:
2026-01-21 14:42:52 +08:00
parent 14f50ecdb2
commit a60a796345
13 changed files with 46 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ func Token(c *gin.Context) {
SetEndpoint(exception.EndpointAuthServiceToken).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorInvalidInput).
SetError(err).
Build()
utils.HttpResponse(c, 400, errorCode)
return
@@ -53,6 +54,7 @@ func Token(c *gin.Context) {
SetEndpoint(exception.EndpointAuthServiceToken).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorInternal).
SetError(err).
Build()
utils.HttpResponse(c, 500, errorCode)
return
@@ -70,6 +72,7 @@ func Token(c *gin.Context) {
SetEndpoint(exception.EndpointAuthServiceToken).
SetType(exception.TypeSpecific).
SetOriginal(exception.AuthTokenGenFailed).
SetError(err).
Build()
utils.HttpResponse(c, 500, errorCode)
return