Skip to content

Commit

Permalink
Adjusted the error handling in the config loader
Browse files Browse the repository at this point in the history
  • Loading branch information
GV14982 committed Sep 12, 2021
1 parent af33d3c commit 84fa682
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions utils/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package config
import (
"encoding/json"
"io/ioutil"

"github.com/clickpop/looks/errors"
)

type Config struct {
Expand Down Expand Up @@ -52,8 +50,12 @@ func LoadConfig(path string) (Config, error) {
filePath = "./config.json"
}
data, err := ioutil.ReadFile(filePath)
errors.HandleError(err)
if err != nil {
return config, err
}
err = json.Unmarshal(data, &config)
errors.HandleError(err)
return config, errors.HandleError(err)
if err != nil {
return config, err
}
return config, nil
}

0 comments on commit 84fa682

Please sign in to comment.