add log output on error

This commit is contained in:
YAMADA Yutaka 2023-05-17 00:48:25 +00:00
parent 9e34636c29
commit 322ad2d3c4

View file

@ -2,6 +2,7 @@ package gitea
import ( import (
"fmt" "fmt"
"log"
"strconv" "strconv"
"strings" "strings"
@ -347,6 +348,7 @@ func setTeamRepositories(team *gitea.Team, d *schema.ResourceData, meta interfac
}, },
}) })
if err != nil { if err != nil {
log.Printf("[ERROR] Error listeng team repositories: %s", err)
return return
} }
if len(existingRepositories) == 0 { if len(existingRepositories) == 0 {
@ -360,6 +362,7 @@ func setTeamRepositories(team *gitea.Team, d *schema.ResourceData, meta interfac
} else { } else {
_, err = client.RemoveTeamRepository(team.ID, org, exr.Name) _, err = client.RemoveTeamRepository(team.ID, org, exr.Name)
if err != nil { if err != nil {
log.Printf("[ERROR] Error removing team repository %q: %s", exr.Name, err)
return return
} }
} }
@ -373,6 +376,7 @@ func setTeamRepositories(team *gitea.Team, d *schema.ResourceData, meta interfac
if flag { if flag {
_, err = client.AddTeamRepository(team.ID, org, repo) _, err = client.AddTeamRepository(team.ID, org, repo)
if err != nil { if err != nil {
log.Printf("[ERROR] Error adding team repository %q: %s", repo, err)
return return
} }
} }