Remove calls to Error()

Now that we have an error handler set, we can simply let them bubble up all the
way to gocui.
This commit is contained in:
Stefan Haller 2024-04-11 21:57:13 +02:00
parent 325800a72e
commit 82a3d33ce3
35 changed files with 158 additions and 168 deletions

View file

@ -234,10 +234,7 @@ type hardResetOptions struct {
// only to be used in the undo flow for now (does an autostash)
func (self *UndoController) hardResetWithAutoStash(commitHash string, options hardResetOptions) error {
reset := func() error {
if err := self.c.Helpers().Refs.ResetToRef(commitHash, "hard", options.EnvVars); err != nil {
return self.c.Error(err)
}
return nil
return self.c.Helpers().Refs.ResetToRef(commitHash, "hard", options.EnvVars)
}
// if we have any modified tracked files we need to ask the user if they want us to stash for them
@ -250,20 +247,17 @@ func (self *UndoController) hardResetWithAutoStash(commitHash string, options ha
HandleConfirm: func() error {
return self.c.WithWaitingStatus(options.WaitingStatus, func(gocui.Task) error {
if err := self.c.Git().Stash.Push(self.c.Tr.StashPrefix + commitHash); err != nil {
return self.c.Error(err)
return err
}
if err := reset(); err != nil {
return err
}
err := self.c.Git().Stash.Pop(0)
if err := self.c.Refresh(types.RefreshOptions{}); err != nil {
if err != nil {
return err
}
if err != nil {
return self.c.Error(err)
}
return nil
return self.c.Refresh(types.RefreshOptions{})
})
},
})