feat: exit on error
This commit is contained in:
@@ -54,6 +54,9 @@ func NewModel(db geodata.TimezoneMap, ghUser, manualTz string) Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m Model) Init() tea.Cmd {
|
func (m Model) Init() tea.Cmd {
|
||||||
|
if m.err != nil {
|
||||||
|
return tea.Quit
|
||||||
|
}
|
||||||
if m.loadingGithubTz {
|
if m.loadingGithubTz {
|
||||||
return fetchGithubCmd(m.username)
|
return fetchGithubCmd(m.username)
|
||||||
}
|
}
|
||||||
@@ -76,7 +79,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case errMsg:
|
case errMsg:
|
||||||
m.err = msg
|
m.err = msg
|
||||||
return m, nil
|
return m, tea.Quit
|
||||||
|
// seems like bubbletea will render once and then quit
|
||||||
|
// as I get my error msg printed
|
||||||
|
|
||||||
case tzsMsg:
|
case tzsMsg:
|
||||||
preds, err := core.GetStatsForTZs(msg)
|
preds, err := core.GetStatsForTZs(msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user