From 1106981827f5730ae9e71ff38bde27751fc66213 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 28 Aug 2023 13:18:58 +0200 Subject: Extract a SaveAppStateAndLogError function It seems that most actions that change a state option and resave the state want to just log the error. --- pkg/gui/gui_common.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pkg/gui/gui_common.go') diff --git a/pkg/gui/gui_common.go b/pkg/gui/gui_common.go index e3e288c11..bad0957ec 100644 --- a/pkg/gui/gui_common.go +++ b/pkg/gui/gui_common.go @@ -92,6 +92,12 @@ func (self *guiCommon) SaveAppState() error { return self.gui.Config.SaveAppState() } +func (self *guiCommon) SaveAppStateAndLogError() { + if err := self.gui.Config.SaveAppState(); err != nil { + self.gui.Log.Errorf("error when saving app state: %v", err) + } +} + func (self *guiCommon) GetConfig() config.AppConfigurer { return self.gui.Config } -- cgit v1.2.3