Warn when Koanf read fails #47
Reference in New Issue
Block a user
No description provided.
Delete Branch "Hunman/itd:error-handling"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Figured out the problem in issue #32, the toml file syntax was invalid (I had
'instead of"at some values), but there was nothing in the logs about it.Moved the config reading (and watching) into the same function, which logs the error as a warning.
I wanted to try moving the whole
ifinto a separate function, but I kept getting errors when I tried to extract thepathfrom theFile, so I have that attempt in a separate branch not in this pull request:5a84bf8148Other than these two minor changes, it looks good, thanks!
@@ -71,0 +68,4 @@provider := file.Provider(filename)if cfgError := k.Load(provider, toml.Parser()); cfgError != nil {log.Warn().Msg(fmt.Sprintf("Error while trying to read %s: %s\n", filename, cfgError.Error()))@@ -76,2 +79,3 @@k.Load(provider, toml.Parser())if cfgError := k.Load(provider, toml.Parser()); cfgError != nil {log.Warn().Msg(fmt.Sprintf("Error while trying to read %s: %s\n", filename, cfgError.Error()))Same as above
Huh, neat
Thanks, merging now