Improve error handling in configuration parsing
This commit is contained in:
parent
d906a3c547
commit
afb7597f97
3 changed files with 2 additions and 3 deletions
|
@ -66,6 +66,7 @@ func main() {
|
|||
|
||||
fullConfig, err := config.Parse(configPath)
|
||||
if err != nil {
|
||||
Log.Error(err)
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue