From ac049eaade6232e6a6dde0ff8dea3a37e5fcdd8c Mon Sep 17 00:00:00 2001 From: Paul Erickson Date: Fri, 17 Dec 2021 16:27:22 -0600 Subject: [PATCH] Improve error logging --- server/events/vcs/github_client.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/events/vcs/github_client.go b/server/events/vcs/github_client.go index 3af7247a6f..96f7877d6c 100644 --- a/server/events/vcs/github_client.go +++ b/server/events/vcs/github_client.go @@ -463,11 +463,13 @@ func (g *GithubClient) GetTeamNamesForUser(repo models.Repo, user models.User) ( for { teams, resp, err := g.client.Teams.ListTeams(g.ctx, org, opts) if err != nil { - return nil, err + return nil, errors.Wrap(err, "retrieving GitHub teams") } for _, t := range teams { membership, _, err := g.client.Teams.GetTeamMembershipBySlug(g.ctx, org, *t.Slug, user.Username) - if err == nil && membership != nil { + if err != nil { + g.logger.Err("Failed to get team membership from GitHub: %s", err) + } else if membership != nil { if *membership.State == "active" && (*membership.Role == "member" || *membership.Role == "maintainer") { teamNames = append(teamNames, t.GetName()) }