mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Pass through github client errors to display
Per #598, we crash on occasion. We are swallowing errors incorrectly, and should catch/render
This commit is contained in:
parent
34d6d03b43
commit
12a006f5a8
@ -15,6 +15,8 @@ func (widget *Widget) content() (string, string, bool) {
|
||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(repo))
|
||||
if repo == nil {
|
||||
return title, " GitHub repo data is unavailable ", false
|
||||
} else if repo.Err != nil {
|
||||
return title, repo.Err.Error(), true
|
||||
}
|
||||
|
||||
_, _, width, _ := widget.View.GetRect()
|
||||
|
@ -19,6 +19,7 @@ type GithubRepo struct {
|
||||
Owner string
|
||||
PullRequests []*ghb.PullRequest
|
||||
RemoteRepo *ghb.Repository
|
||||
Err error
|
||||
}
|
||||
|
||||
func NewGithubRepo(name, owner, apiKey, baseURL, uploadURL string) *GithubRepo {
|
||||
@ -40,8 +41,15 @@ func (repo *GithubRepo) Open() {
|
||||
|
||||
// Refresh reloads the github data via the Github API
|
||||
func (repo *GithubRepo) Refresh() {
|
||||
repo.PullRequests, _ = repo.loadPullRequests()
|
||||
repo.RemoteRepo, _ = repo.loadRemoteRepository()
|
||||
prs, err := repo.loadPullRequests()
|
||||
repo.Err = err
|
||||
repo.PullRequests = prs
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
remote, err := repo.loadRemoteRepository()
|
||||
repo.Err = err
|
||||
repo.RemoteRepo = remote
|
||||
}
|
||||
|
||||
/* -------------------- Counts -------------------- */
|
||||
|
Loading…
x
Reference in New Issue
Block a user