Verbessere Logging und Fehlerbehandlung
This commit is contained in:
parent
c737818ce4
commit
6e97d867de
14 changed files with 223 additions and 88 deletions
|
@ -51,12 +51,14 @@ type Config struct {
|
|||
func ReadConfigFile(filename string, conf *Config) error {
|
||||
configData, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
log.Printf("Error reading config file: %s", err.Error())
|
||||
err = fmt.Errorf("Error reading config file: %w", err)
|
||||
log.Println(err.Error())
|
||||
return err
|
||||
}
|
||||
err = json.Unmarshal(configData, conf)
|
||||
if err != nil {
|
||||
log.Printf("Error parsing config file as json: %s", err.Error())
|
||||
err = fmt.Errorf("Error parsing config file as json: %w", err)
|
||||
log.Println(err.Error())
|
||||
return err
|
||||
}
|
||||
return validateConfig(conf)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue