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,8 @@
package controllers
import (
"errors"
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers"
@ -114,7 +116,7 @@ func (self *CommitMessageController) setCommitMessageAtIndex(index int) (bool, e
if err == git_commands.ErrInvalidCommitIndex {
return false, nil
}
return false, self.c.ErrorMsg(self.c.Tr.CommitWithoutMessageErr)
return false, errors.New(self.c.Tr.CommitWithoutMessageErr)
}
if self.c.UserConfig.Git.Commit.AutoWrapCommitMessage {
commitMessage = helpers.TryRemoveHardLineBreaks(commitMessage, self.c.UserConfig.Git.Commit.AutoWrapWidth)