Skip to content

Commit

Permalink
Improve error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
paulerickson committed Dec 17, 2021
1 parent 23c5cd9 commit ac049ea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/events/vcs/github_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit ac049ea

Please sign in to comment.