mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge pull request #603 from Seanstoppable/handlegithubclienterr
Pass through github client errors to display
This commit is contained in:
commit
a781c20088
@ -15,6 +15,8 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(repo))
|
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(repo))
|
||||||
if repo == nil {
|
if repo == nil {
|
||||||
return title, " GitHub repo data is unavailable ", false
|
return title, " GitHub repo data is unavailable ", false
|
||||||
|
} else if repo.Err != nil {
|
||||||
|
return title, repo.Err.Error(), true
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
|
@ -19,6 +19,7 @@ type GithubRepo struct {
|
|||||||
Owner string
|
Owner string
|
||||||
PullRequests []*ghb.PullRequest
|
PullRequests []*ghb.PullRequest
|
||||||
RemoteRepo *ghb.Repository
|
RemoteRepo *ghb.Repository
|
||||||
|
Err error
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGithubRepo(name, owner, apiKey, baseURL, uploadURL string) *GithubRepo {
|
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
|
// Refresh reloads the github data via the Github API
|
||||||
func (repo *GithubRepo) Refresh() {
|
func (repo *GithubRepo) Refresh() {
|
||||||
repo.PullRequests, _ = repo.loadPullRequests()
|
prs, err := repo.loadPullRequests()
|
||||||
repo.RemoteRepo, _ = repo.loadRemoteRepository()
|
repo.Err = err
|
||||||
|
repo.PullRequests = prs
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
remote, err := repo.loadRemoteRepository()
|
||||||
|
repo.Err = err
|
||||||
|
repo.RemoteRepo = remote
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- Counts -------------------- */
|
/* -------------------- Counts -------------------- */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user