Commit 17f17142 by JustSong

fix: handle errors when update option map

parent d11134d9
...@@ -53,7 +53,10 @@ func InitOptionMap() { ...@@ -53,7 +53,10 @@ func InitOptionMap() {
common.OptionMapRWMutex.Unlock() common.OptionMapRWMutex.Unlock()
options, _ := AllOption() options, _ := AllOption()
for _, option := range options { 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 { ...@@ -70,8 +73,7 @@ func UpdateOption(key string, value string) error {
// otherwise it will execute Update (with all fields). // otherwise it will execute Update (with all fields).
DB.Save(&option) DB.Save(&option)
// Update OptionMap // Update OptionMap
updateOptionMap(key, value) return updateOptionMap(key, value)
return nil
} }
func updateOptionMap(key string, value string) (err error) { func updateOptionMap(key string, value string) (err error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment