feat: exit on error

This commit is contained in:
2026-02-10 22:14:02 +00:00
parent 15eb2c9cf4
commit 315c0ad8e4
+6 -1
View File
@@ -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)