1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Remove ErrorMsg

There is no reason any more for application code to show error messages in a
panel. Just return an error instead.
This commit is contained in:
Stefan Haller
2024-04-15 08:25:17 +02:00
parent 723b92916d
commit caad553502
27 changed files with 98 additions and 73 deletions

View File

@ -1,6 +1,7 @@
package controllers
import (
"errors"
"fmt"
"github.com/jesseduffield/gocui"
@ -15,11 +16,11 @@ type CustomPatchOptionsMenuAction struct {
func (self *CustomPatchOptionsMenuAction) Call() error {
if !self.c.Git().Patch.PatchBuilder.Active() {
return self.c.ErrorMsg(self.c.Tr.NoPatchError)
return errors.New(self.c.Tr.NoPatchError)
}
if self.c.Git().Patch.PatchBuilder.IsEmpty() {
return self.c.ErrorMsg(self.c.Tr.EmptyPatchError)
return errors.New(self.c.Tr.EmptyPatchError)
}
menuItems := []*types.MenuItem{
@ -115,7 +116,7 @@ func (self *CustomPatchOptionsMenuAction) getPatchCommitIndex() int {
func (self *CustomPatchOptionsMenuAction) validateNormalWorkingTreeState() (bool, error) {
if self.c.Git().Status.WorkingTreeState() != enums.REBASE_MODE_NONE {
return false, self.c.ErrorMsg(self.c.Tr.CantPatchWhileRebasingError)
return false, errors.New(self.c.Tr.CantPatchWhileRebasingError)
}
return true, nil
}