diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-02-18 19:42:23 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-02-18 19:42:23 +1100 |
commit | adc252901944e84433cb8a50de9b114ba120282d (patch) | |
tree | 914cc8c0276f402ff1b0dfbcb3b89dfbab242936 /pkg/gui/gui.go | |
parent | 43ab7318d37e049cf3ae406fed8823c5c7f577a3 (diff) |
dealing better with errors at the top level
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r-- | pkg/gui/gui.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index f001a8113..11daec652 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -7,7 +7,6 @@ import ( // "io/ioutil" "io/ioutil" - "log" "os" "os/exec" "strings" @@ -577,7 +576,7 @@ func (gui *Gui) Run() error { // RunWithSubprocesses loops, instantiating a new gocui.Gui with each iteration // if the error returned from a run is a ErrSubProcess, it runs the subprocess // otherwise it handles the error, possibly by quitting the application -func (gui *Gui) RunWithSubprocesses() { +func (gui *Gui) RunWithSubprocesses() error { for { if err := gui.Run(); err != nil { if err == gocui.ErrQuit { @@ -594,12 +593,11 @@ func (gui *Gui) RunWithSubprocesses() { gui.SubProcess.Stdin = nil gui.SubProcess = nil } else { - newErr := errors.Wrap(err, 0) - stackTrace := newErr.ErrorStack() - log.Panicln(stackTrace) + return err } } } + return nil } func (gui *Gui) quit(g *gocui.Gui, v *gocui.View) error { |