mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Make OnWorker callback return an error
This lets us get rid of a few more calls to Error(), and it simplifies things for clients of OnWorker: they can simply return an error from their callback like we do everywhere else.
This commit is contained in:
parent
5396a70661
commit
1869fda800
12 changed files with 30 additions and 44 deletions
|
@ -104,8 +104,9 @@ func (self *RefreshHelper) Refresh(options types.RefreshOptions) error {
|
|||
// everything happens fast and it's better to have everything update
|
||||
// in the one frame
|
||||
if !self.c.InDemo() && options.Mode == types.ASYNC {
|
||||
self.c.OnWorker(func(t gocui.Task) {
|
||||
self.c.OnWorker(func(t gocui.Task) error {
|
||||
f()
|
||||
return nil
|
||||
})
|
||||
} else {
|
||||
wg.Add(1)
|
||||
|
@ -246,10 +247,11 @@ func getModeName(mode types.RefreshMode) string {
|
|||
func (self *RefreshHelper) refreshReflogCommitsConsideringStartup() {
|
||||
switch self.c.State().GetRepoState().GetStartupStage() {
|
||||
case types.INITIAL:
|
||||
self.c.OnWorker(func(_ gocui.Task) {
|
||||
self.c.OnWorker(func(_ gocui.Task) error {
|
||||
_ = self.refreshReflogCommits()
|
||||
self.refreshBranches(false, true)
|
||||
self.c.State().GetRepoState().SetStartupStage(types.COMPLETE)
|
||||
return nil
|
||||
})
|
||||
|
||||
case types.COMPLETE:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue