Skip to content

Commit

Permalink
Rename Error() to ErrorHandler()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stefanhaller committed Apr 18, 2024
1 parent 6539948 commit 723b929
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions pkg/gui/popup/popup_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/gui/types/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
Expand Down

0 comments on commit 723b929

Please sign in to comment.