pull errors out of package scope and store sentinel errors on the gui struct

This commit is contained in:
Jesse Duffield 2018-08-14 23:47:14 +10:00
parent 4d0702fba5
commit ba2b6fbf1f
5 changed files with 49 additions and 44 deletions

View file

@ -12,13 +12,13 @@ func (gui *Gui) handleCommitConfirm(g *gocui.Gui, v *gocui.View) error {
sub, err := gui.GitCommand.Commit(g, message)
if err != nil {
// TODO need to find a way to send through this error
if err != ErrSubProcess {
if err != gui.Errors.ErrSubProcess {
return gui.createErrorPanel(g, err.Error())
}
}
if sub != nil {
gui.SubProcess = sub
return ErrSubProcess
return gui.Errors.ErrSubProcess
}
gui.refreshFiles(g)
v.Clear()