Add context for all exceptions

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-21 19:37:20 +08:00
parent 154c929859
commit 986f63c0af
16 changed files with 91 additions and 87 deletions

View File

@@ -31,7 +31,7 @@ func Exchange(c *gin.Context) {
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorInvalidInput).
SetError(err).
Build()
Build(c)
utils.HttpResponse(c, 400, errorCode)
return
}
@@ -44,7 +44,7 @@ func Exchange(c *gin.Context) {
SetEndpoint(exception.EndpointAuthServiceExchange).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorUnauthorized).
Build()
Build(c)
utils.HttpResponse(c, 401, errorCode)
return
}
@@ -58,7 +58,7 @@ func Exchange(c *gin.Context) {
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorUuidParseFailed).
SetError(err).
Build()
Build(c)
utils.HttpResponse(c, 500, errorCode)
return
}
@@ -73,7 +73,7 @@ func Exchange(c *gin.Context) {
SetType(exception.TypeSpecific).
SetOriginal(exception.AuthExchangeGetUserIdFailed).
SetError(err).
Build()
Build(c)
utils.HttpResponse(c, 500, errorCode)
return
}
@@ -87,7 +87,7 @@ func Exchange(c *gin.Context) {
SetType(exception.TypeSpecific).
SetOriginal(exception.AuthExchangeCodeGenFailed).
SetError(err).
Build()
Build(c)
utils.HttpResponse(c, 500, errorCode)
return
}
@@ -101,7 +101,7 @@ func Exchange(c *gin.Context) {
SetType(exception.TypeSpecific).
SetOriginal(exception.AuthExchangeInvalidRedirectUri).
SetError(err).
Build()
Build(c)
utils.HttpResponse(c, 400, errorCode)
return
}
@@ -119,6 +119,6 @@ func Exchange(c *gin.Context) {
SetEndpoint(exception.EndpointAuthServiceExchange).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
Build()
Build(c)
utils.HttpResponse(c, 200, errorCode, exchangeResp)
}