diff options
author | Christian Rocha <christian@rocha.is> | 2020-07-16 15:41:16 -0400 |
---|---|---|
committer | Christian Muehlhaeuser <muesli@gmail.com> | 2020-10-05 13:50:04 +0200 |
commit | 4cfd1fc897f8f9264c66119246c1cd641d403114 (patch) | |
tree | 48caf846efe94b425b26e2c7d9c437f1b5acf9fa /ui | |
parent | 3409ca342a1e9da6fe5ccd6898216319fc8123b8 (diff) |
Better error view language depending on whether error is fatal
Diffstat (limited to 'ui')
-rw-r--r-- | ui/stash.go | 2 | ||||
-rw-r--r-- | ui/ui.go | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/ui/stash.go b/ui/stash.go index bf6aa00..4e01ade 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -443,7 +443,7 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) { func stashView(m stashModel) string { if m.showError { - return errorView(m.err) + return errorView(m.err, false) } var s string @@ -323,7 +323,7 @@ func view(mdl tea.Model) string { } if m.fatalErr != nil { - return errorView(m.fatalErr) + return errorView(m.fatalErr, true) } var s string @@ -338,14 +338,20 @@ func view(mdl tea.Model) string { return "\n" + indent(s, 2) } -func errorView(err error) string { +func errorView(err error, fatal bool) string { + exitMsg := "press any key to " + if fatal { + exitMsg += "exit" + } else { + exitMsg += "return" + } s := fmt.Sprintf("%s\n\n%v\n\n%s", te.String(" ERROR "). Foreground(common.Cream.Color()). Background(common.Red.Color()). String(), err, - common.Subtle("Press any key to exit"), + common.Subtle(exitMsg), ) return "\n" + indent(s, 3) } |