Fix some type change bugs (error)
Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
@@ -25,10 +25,10 @@ func Exchange(c *gin.Context) {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthExchangeEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceExchange).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
@@ -38,10 +38,10 @@ func Exchange(c *gin.Context) {
|
||||
userIdOrig, ok := c.Get("user_id")
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthExchangeEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceExchange).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUnauthorized).
|
||||
Build()
|
||||
utils.HttpResponse(c, 401, errorCode)
|
||||
@@ -51,10 +51,10 @@ func Exchange(c *gin.Context) {
|
||||
userId, err := uuid.Parse(userIdOrig.(string))
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthExchangeEndpoint).
|
||||
SetType(exception.ErrorTypeCommon).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceExchange).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -65,10 +65,10 @@ func Exchange(c *gin.Context) {
|
||||
user, err := userData.GetByUserId(userId)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthExchangeEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceExchange).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthExchangeGetUserIdFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -78,10 +78,10 @@ func Exchange(c *gin.Context) {
|
||||
code, err := authcode.NewAuthCode(exchangeReq.ClientId, user.Email)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusServer).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthExchangeEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceExchange).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthExchangeCodeGenFailed).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
@@ -91,10 +91,10 @@ func Exchange(c *gin.Context) {
|
||||
url, err := url.Parse(exchangeReq.RedirectUri)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.ErrorStatusClient).
|
||||
SetService(exception.AuthService).
|
||||
SetEndpoint(exception.AuthExchangeEndpoint).
|
||||
SetType(exception.ErrorTypeSpecific).
|
||||
SetStatus(exception.StatusClient).
|
||||
SetService(exception.ServiceAuth).
|
||||
SetEndpoint(exception.EndpointAuthServiceExchange).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.AuthExchangeInvalidRedirectUri).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
|
||||
Reference in New Issue
Block a user