summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Rocha <christian@rocha.is>2020-07-16 15:41:16 -0400
committerChristian Muehlhaeuser <muesli@gmail.com>2020-10-05 13:50:04 +0200
commit4cfd1fc897f8f9264c66119246c1cd641d403114 (patch)
tree48caf846efe94b425b26e2c7d9c437f1b5acf9fa
parent3409ca342a1e9da6fe5ccd6898216319fc8123b8 (diff)
Better error view language depending on whether error is fatal
-rw-r--r--ui/stash.go2
-rw-r--r--ui/ui.go12
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
diff --git a/ui/ui.go b/ui/ui.go
index 02dbc96..114a68a 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -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)
}