From afb7597f9737bab04306f9d537c75722805349d5 Mon Sep 17 00:00:00 2001 From: Blallo Date: Tue, 1 Jun 2021 12:12:22 +0200 Subject: [PATCH] Improve error handling in configuration parsing --- cli/papero/main.go | 1 + config/config.go | 2 +- config/parse.go | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cli/papero/main.go b/cli/papero/main.go index b0d4148..699a38f 100644 --- a/cli/papero/main.go +++ b/cli/papero/main.go @@ -66,6 +66,7 @@ func main() { fullConfig, err := config.Parse(configPath) if err != nil { + Log.Error(err) os.Exit(2) } diff --git a/config/config.go b/config/config.go index c16b767..cfe3ccd 100644 --- a/config/config.go +++ b/config/config.go @@ -47,7 +47,7 @@ func (c CastingErrors) Check() bool { if len(c.GeneralErrors) != 0 { return false } - for _, err := range c.GeneralErrors { + for _, err := range c.AccountErrors { if err != nil { return false } diff --git a/config/parse.go b/config/parse.go index dedcb84..26d641d 100644 --- a/config/parse.go +++ b/config/parse.go @@ -3,7 +3,6 @@ package config import ( "errors" "fmt" - "log" "os" "path" @@ -21,7 +20,6 @@ func Parse(filePath string) (*MemConfig, error) { } memConfig, castingErrs := parseConfig(fileConfig) if !castingErrs.Check() { - log.Print(castingErrs) return nil, ErrFailedToParseConfig } return memConfig, nil