Warn when Koanf read fails #47
No reviewers
Labels
No Label
Bug
Cantfix
Duplicate
Enhancement
External
Help Wanted
In Progress
Invalid
Question
Waiting
Waiting For Info
Waiting for Upstream
Wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Elara6331/itd#47
Loading…
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
if
into a separate function, but I kept getting errors when I tried to extract thepath
from theFile
, so I have that attempt in a separate branch not in this pull request:5a84bf8148
Other 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