summaryrefslogtreecommitdiffstats
path: root/ui/ui.go
diff options
context:
space:
mode:
authorChristian Rocha <christian@rocha.is>2020-07-17 12:25:40 -0400
committerChristian Muehlhaeuser <muesli@gmail.com>2020-10-05 13:50:04 +0200
commit3b3bf684f9e0f48fb84bc2ba7308d1331a7e6d38 (patch)
tree7ac2aad218383f831452af2b89cbbab424c07cee /ui/ui.go
parenta35d83d5d25dc4ebf4d8545866a156403ca06e75 (diff)
Detect when stash and news loading fails (and update the UI accordingly)
Diffstat (limited to 'ui/ui.go')
-rw-r--r--ui/ui.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/ui/ui.go b/ui/ui.go
index 6ca8c1f..4912ba5 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -37,7 +37,7 @@ func NewProgram(style string, cfg UIConfig) *tea.Program {
if config.Logfile != "" {
log.Println("-- Starting Glow ----------------")
log.Printf("High performance pager: %v", cfg.HighPerformancePager)
- log.Printf("Render with Glamour: %v", cfg.GlamourEnabled)
+ log.Printf("Glamour rendering: %v", cfg.GlamourEnabled)
log.Println("Bubble Tea now initializing...")
}
return tea.NewProgram(initialize(style), update, view)
@@ -57,7 +57,9 @@ type initLocalFileSearchMsg struct {
type foundLocalFileMsg string
type localFileSearchFinished struct{}
type gotStashMsg []*charm.Markdown
+type stashLoadErrMsg struct{ err error }
type gotNewsMsg []*charm.Markdown
+type newsLoadErrMsg struct{ err error }
// MODEL
@@ -398,7 +400,7 @@ func loadStash(m stashModel) tea.Cmd {
return func() tea.Msg {
stash, err := m.cc.GetStash(m.page)
if err != nil {
- return errMsg(err)
+ return stashLoadErrMsg{err: err}
}
return gotStashMsg(stash)
}
@@ -408,7 +410,7 @@ func loadNews(m stashModel) tea.Cmd {
return func() tea.Msg {
news, err := m.cc.GetNews(1) // just fetch the first page
if err != nil {
- return errMsg(err)
+ return newsLoadErrMsg{err: err}
}
return gotNewsMsg(news)
}