From 24d0ca4aa02bd4245cd4c91f71b918c5da1d2e7d Mon Sep 17 00:00:00 2001 From: skyblue Date: Wed, 9 Apr 2014 00:31:09 +0800 Subject: [PATCH] clean tail --- models/oauth2.go | 8 ++------ routers/user/social.go | 3 +++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/models/oauth2.go b/models/oauth2.go index 10771d6a7..4da980067 100644 --- a/models/oauth2.go +++ b/models/oauth2.go @@ -1,9 +1,6 @@ package models -import ( - "errors" - "fmt" -) +import "errors" // OT: Oauth2 Type const ( @@ -41,8 +38,7 @@ func GetOauth2(identity string) (oa *Oauth2, err error) { return } if !exists { - err = fmt.Errorf("not exists oauth2: %s", identity) - return + return nil, ErrOauth2RecordNotExists } if oa.Uid == 0 { return oa, ErrOauth2NotAssociatedWithUser diff --git a/routers/user/social.go b/routers/user/social.go index b47a4c1ce..7b4d23298 100644 --- a/routers/user/social.go +++ b/routers/user/social.go @@ -109,6 +109,9 @@ func SocialSignIn(ctx *middleware.Context, tokens oauth2.Tokens) { } case models.ErrOauth2NotAssociatedWithUser: // pass + default: + log.Error(err) // FIXME: handle error page + return } ctx.Session.Set("socialId", oa.Id) log.Info("socialId: %v", oa.Id)