From 45a0378c01236af91451a1fbf14aa2e65561200b Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 26 Aug 2020 08:20:33 +1000 Subject: do not create error panel for sentinel errors --- pkg/gui/confirmation_panel.go | 6 ++++++ pkg/gui/gui.go | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index ed8a0137f..103b6a084 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -244,5 +244,11 @@ func (gui *Gui) createErrorPanel(message string) error { } func (gui *Gui) surfaceError(err error) error { + for _, sentinelError := range gui.sentinelErrorsArr() { + if err == sentinelError { + return err + } + } + return gui.createErrorPanel(err.Error()) } diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 12d680ab9..e95ef1e99 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -72,6 +72,15 @@ func (gui *Gui) GenerateSentinelErrors() { } } +func (gui *Gui) sentinelErrorsArr() []error { + return []error{ + gui.Errors.ErrSubProcess, + gui.Errors.ErrNoFiles, + gui.Errors.ErrSwitchRepo, + gui.Errors.ErrRestart, + } +} + // Teml is short for template used to make the required map[string]interface{} shorter when using gui.Tr.SLocalize and gui.Tr.TemplateLocalize type Teml i18n.Teml -- cgit v1.2.3