1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

better error handling

This commit is contained in:
Jesse Duffield
2020-03-28 11:47:54 +11:00
parent 7876cddf4a
commit 814ee24c8d
21 changed files with 108 additions and 173 deletions

View File

@ -8,7 +8,7 @@ import (
func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error {
if !gui.GitCommand.PatchManager.CommitSelected() {
return gui.createErrorPanel(gui.g, gui.Tr.SLocalize("NoPatchError"))
return gui.createErrorPanel(gui.Tr.SLocalize("NoPatchError"))
}
menuItems := []*menuItem{
@ -60,7 +60,7 @@ func (gui *Gui) getPatchCommitIndex() int {
func (gui *Gui) validateNormalWorkingTreeState() (bool, error) {
if gui.workingTreeState() != "normal" {
return false, gui.createErrorPanel(gui.g, gui.Tr.SLocalize("CantPatchWhileRebasingError"))
return false, gui.createErrorPanel(gui.Tr.SLocalize("CantPatchWhileRebasingError"))
}
return true, nil
}
@ -126,7 +126,7 @@ func (gui *Gui) handleApplyPatch() error {
}
if err := gui.GitCommand.PatchManager.ApplyPatches(false); err != nil {
return gui.createErrorPanel(gui.g, err.Error())
return gui.surfaceError(err)
}
return gui.refreshSidePanels(refreshOptions{mode: ASYNC})
}