1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2026-06-20 01:19:23 +02:00

Keep GitHub PR refresh error logging in one place

This commit is contained in:
Stefan Haller
2026-05-10 15:40:09 +02:00
parent 18ddc9ca9c
commit d9aceaf0da
+6 -11
View File
@@ -831,9 +831,7 @@ func (self *RefreshHelper) refreshGithubPullRequests() {
return return
} }
if err := self.setGithubPullRequests(baseInfo); err != nil { self.setGithubPullRequests(baseInfo)
self.c.LogAction(fmt.Sprintf("Error fetching pull requests from GitHub: %s", err.Error()))
}
} }
type githubRemoteInfo struct { type githubRemoteInfo struct {
@@ -914,9 +912,7 @@ func (self *RefreshHelper) promptForBaseGithubRepo(githubRemotes []githubRemoteI
self.c.Log.Error(err) self.c.Log.Error(err)
} }
if err := self.setGithubPullRequests(&info); err != nil { self.setGithubPullRequests(&info)
self.c.LogAction(fmt.Sprintf("Error fetching pull requests from GitHub: %s", err.Error()))
}
return nil return nil
}) })
}, },
@@ -944,9 +940,9 @@ func (self *RefreshHelper) rebuildPullRequestsMap() {
) )
} }
func (self *RefreshHelper) setGithubPullRequests(baseInfo *githubRemoteInfo) error { func (self *RefreshHelper) setGithubPullRequests(baseInfo *githubRemoteInfo) {
if len(self.c.Model().Branches) == 0 { if len(self.c.Model().Branches) == 0 {
return nil return
} }
branches := lo.Filter(self.c.Model().Branches, func(branch *models.Branch, _ int) bool { branches := lo.Filter(self.c.Model().Branches, func(branch *models.Branch, _ int) bool {
@@ -958,7 +954,8 @@ func (self *RefreshHelper) setGithubPullRequests(baseInfo *githubRemoteInfo) err
prs, err := self.c.Git().GitHub.FetchRecentPRs(branchNames, &baseInfo.serviceInfo, baseInfo.authToken) prs, err := self.c.Git().GitHub.FetchRecentPRs(branchNames, &baseInfo.serviceInfo, baseInfo.authToken)
if err != nil { if err != nil {
return err self.c.LogAction(fmt.Sprintf("Error fetching pull requests from GitHub: %s", err.Error()))
return
} }
self.c.Model().PullRequests = prs self.c.Model().PullRequests = prs
@@ -969,8 +966,6 @@ func (self *RefreshHelper) setGithubPullRequests(baseInfo *githubRemoteInfo) err
self.c.PostRefreshUpdate(self.c.Contexts().Branches) self.c.PostRefreshUpdate(self.c.Contexts().Branches)
return nil return nil
}) })
return nil
} }
func (self *RefreshHelper) savePullRequestsToCache(prs []*models.GithubPullRequest) { func (self *RefreshHelper) savePullRequestsToCache(prs []*models.GithubPullRequest) {