Add context for all exceptions
Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ func Magic(c *gin.Context) {
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -46,7 +46,7 @@ func Magic(c *gin.Context) {
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthMagicTurnstileFailed).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 403, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -60,7 +60,7 @@ func Magic(c *gin.Context) {
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthMagicCodeGenFailed).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -75,7 +75,7 @@ func Magic(c *gin.Context) {
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthMagicInvalidExternalUrl).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -106,7 +106,7 @@ func Magic(c *gin.Context) {
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthMagicInvalidEmailConfig).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -124,6 +124,6 @@ func Magic(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointAuthServiceMagic).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonSuccess).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 200, errorCode)
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ func Redirect(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -34,7 +34,7 @@ func Redirect(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -47,7 +47,7 @@ func Redirect(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -63,7 +63,7 @@ func Redirect(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointAuthServiceRedirect).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthRedirectTokenInvalid).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 403, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -88,7 +88,7 @@ func Redirect(c *gin.Context) {
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInternal).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -100,7 +100,7 @@ func Redirect(c *gin.Context) {
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInternal).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -116,7 +116,7 @@ func Redirect(c *gin.Context) {
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthRedirectClientNotFound).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -130,7 +130,7 @@ func Redirect(c *gin.Context) {
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthRedirectUriMismatch).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -144,7 +144,7 @@ func Redirect(c *gin.Context) {
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInternal).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -158,7 +158,7 @@ func Redirect(c *gin.Context) {
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthRedirectInvalidUri).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func Refresh(c *gin.Context) {
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -40,7 +40,7 @@ func Refresh(c *gin.Context) {
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthRefreshInvalidToken).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 401, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func Refresh(c *gin.Context) {
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthRefreshRenewFailed).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -70,6 +70,6 @@ func Refresh(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointAuthServiceRefresh).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonSuccess).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 200, errorCode, tokenResp)
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ func Token(c *gin.Context) {
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -40,7 +40,7 @@ func Token(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointAuthServiceToken).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthTokenInvalidToken).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 403, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -55,7 +55,7 @@ func Token(c *gin.Context) {
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInternal).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -73,7 +73,7 @@ func Token(c *gin.Context) {
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthTokenGenFailed).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -89,6 +89,6 @@ func Token(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointAuthServiceToken).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonSuccess).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 200, errorCode, tokenResp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user