From fd19d7d246be5249a06a4e3704d9b4920ff2cb50 Mon Sep 17 00:00:00 2001 From: JustSong Date: Sat, 13 May 2023 10:30:55 +0800 Subject: [PATCH] fix: handle errors when update option map --- model/option.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/model/option.go b/model/option.go index 1d25c268..1053f636 100644 --- a/model/option.go +++ b/model/option.go @@ -53,7 +53,10 @@ func InitOptionMap() { common.OptionMapRWMutex.Unlock() options, _ := AllOption() for _, option := range options { - updateOptionMap(option.Key, option.Value) + err := updateOptionMap(option.Key, option.Value) + if err != nil { + common.SysError("Failed to update option map: " + err.Error()) + } } } @@ -70,8 +73,7 @@ func UpdateOption(key string, value string) error { // otherwise it will execute Update (with all fields). DB.Save(&option) // Update OptionMap - updateOptionMap(key, value) - return nil + return updateOptionMap(key, value) } func updateOptionMap(key string, value string) (err error) {