From 9455dbab9f4aee17cc77aed1d2c5d097393fd2fc Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Mon, 8 Sep 2014 23:09:00 -0700 Subject: [PATCH] improved error messaging in Github's GetLogin --- plugin/remote/github/github.go | 5 ++--- plugin/remote/github/register.go | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/remote/github/github.go b/plugin/remote/github/github.go index b2b06f460..2451d5455 100644 --- a/plugin/remote/github/github.go +++ b/plugin/remote/github/github.go @@ -81,13 +81,13 @@ func (r *GitHub) Authorize(res http.ResponseWriter, req *http.Request) (*model.L var trans = &oauth.Transport{Config: config} var token, err = trans.Exchange(code) if err != nil { - return nil, err + return nil, fmt.Errorf("Error exchanging token. %s", err) } var client = NewClient(r.API, token.AccessToken) var useremail, errr = GetUserEmail(client) if errr != nil { - return nil, errr + return nil, fmt.Errorf("Error retrieving user or verified email. %s", errr) } var login = new(model.Login) @@ -95,7 +95,6 @@ func (r *GitHub) Authorize(res http.ResponseWriter, req *http.Request) (*model.L login.Access = token.AccessToken login.Login = *useremail.Login login.Email = *useremail.Email - login.Name = *useremail.Email if useremail.Name != nil { login.Name = *useremail.Name } diff --git a/plugin/remote/github/register.go b/plugin/remote/github/register.go index ae4e1e946..6144ff8a6 100644 --- a/plugin/remote/github/register.go +++ b/plugin/remote/github/register.go @@ -44,6 +44,7 @@ func registerGitHubEnterprise() { len(*githubEnterpriseSecret) == 0 { return } + remote.Register( New( *githubEnterpriseURL,