Skip to content
This repository was archived by the owner on Jul 15, 2024. It is now read-only.

Commit f198150

Browse files
committed
fix: pr comment, do not put full response in err
Signed-off-by: mlosicki <[email protected]>
1 parent 216d0ee commit f198150

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

pkg/services/pull_request/bitbucket_server.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
"github.com/argoproj/applicationset/pkg/utils"
99
bitbucketv1 "github.com/gfleury/go-bitbucket-v1"
10+
log "github.com/sirupsen/logrus"
1011
)
1112

1213
type BitbucketService struct {
@@ -71,7 +72,8 @@ func (b *BitbucketService) List(_ context.Context) ([]*PullRequest, error) {
7172
}
7273
pulls, err := bitbucketv1.GetPullRequestsResponse(response)
7374
if err != nil {
74-
return nil, fmt.Errorf("error parsing pull request response %s: %v", response.Values, err)
75+
log.Errorf("error parsing pull request response '%v'", response.Values)
76+
return nil, fmt.Errorf("error parsing pull request response for %s/%s: %v", b.projectKey, b.repositorySlug, err)
7577
}
7678

7779
for _, pull := range pulls {

pkg/services/scm_provider/bitbucket_server.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/argoproj/applicationset/pkg/utils"
88
bitbucketv1 "github.com/gfleury/go-bitbucket-v1"
9+
log "github.com/sirupsen/logrus"
910
)
1011

1112
type BitbucketServerProvider struct {
@@ -56,7 +57,8 @@ func (b *BitbucketServerProvider) ListRepos(_ context.Context, cloneProtocol str
5657
}
5758
repositories, err := bitbucketv1.GetRepositoriesResponse(response)
5859
if err != nil {
59-
return nil, fmt.Errorf("error parsing repositories response %s: %v", response.Values, err)
60+
log.Errorf("error parsing repositories response '%v'", response.Values)
61+
return nil, fmt.Errorf("error parsing repositories response %s: %v", b.projectKey, err)
6062
}
6163
for _, bitbucketRepo := range repositories {
6264
var url string
@@ -171,7 +173,8 @@ func (b *BitbucketServerProvider) listBranches(repo *Repository) ([]bitbucketv1.
171173
}
172174
bitbucketBranches, err := bitbucketv1.GetBranchesResponse(response)
173175
if err != nil {
174-
return nil, fmt.Errorf("error parsing branches response %s: %v", response.Values, err)
176+
log.Errorf("error parsing branches response '%v'", response.Values)
177+
return nil, fmt.Errorf("error parsing branches response for %s/%s: %v", repo.Organization, repo.Repository, err)
175178
}
176179

177180
branches = append(branches, bitbucketBranches...)

0 commit comments

Comments
 (0)