diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-04-14 20:25:06 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-04-18 10:10:30 +0200 |
commit | 723b92916d3b5a19de6c1d1673972dc4b241f5b7 (patch) | |
tree | d67270d8c4e484ceffcc2afc4e40fea13b436b12 | |
parent | 653994845ef9c1b7f47a9479ec70fd4cd64c5ab8 (diff) |
Rename Error() to ErrorHandler()
It is now only used as the error handler that is passed to gocui.Gui on
construction; it's not a client-facing API any more. Also, it doesn't have to
handle gocui.ErrQuit, as gocui takes care of that.
-rw-r--r-- | pkg/gui/gui.go | 2 | ||||
-rw-r--r-- | pkg/gui/popup/popup_handler.go | 6 | ||||
-rw-r--r-- | pkg/gui/types/common.go | 3 |
3 files changed, 4 insertions, 7 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 90dd4ea77..4bb910bf2 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -652,7 +652,7 @@ func (gui *Gui) Run(startArgs appTypes.StartArgs) error { gui.g = g defer gui.g.Close() - g.ErrorHandler = gui.PopupHandler.Error + g.ErrorHandler = gui.PopupHandler.ErrorHandler // if the deadlock package wants to report a deadlock, we first need to // close the gui so that we can actually read what it prints. diff --git a/pkg/gui/popup/popup_handler.go b/pkg/gui/popup/popup_handler.go index c8ff10d85..f5a6eb8c6 100644 --- a/pkg/gui/popup/popup_handler.go +++ b/pkg/gui/popup/popup_handler.go @@ -79,11 +79,7 @@ func (self *PopupHandler) WithWaitingStatusSync(message string, f func() error) return self.withWaitingStatusSyncFn(message, f) } -func (self *PopupHandler) Error(err error) error { - if err == gocui.ErrQuit { - return err - } - +func (self *PopupHandler) ErrorHandler(err error) error { return self.ErrorMsg(err.Error()) } diff --git a/pkg/gui/types/common.go b/pkg/gui/types/common.go index 6675668b0..3b959be56 100644 --- a/pkg/gui/types/common.go +++ b/pkg/gui/types/common.go @@ -135,7 +135,8 @@ type IPopupHandler interface { // // This is a convenience wrapper around Alert(). ErrorMsg(message string) error - Error(err error) error + // The global error handler for gocui. Not to be used by application code. + ErrorHandler(err error) error // Shows a notification popup with the given title and message to the user. // // This is a convenience wrapper around Confirm(), thus the popup can be closed using both 'Enter' and 'ESC'. |