1
0
mirror of https://github.com/taigrr/wtf synced 2026-03-29 07:35:16 -07:00

Clean up cfg error handling a bit

Pass in the actual file being used, rather than hardcoded `config.yaml`
Differences between two error messages are not that distinct
Centralize on one and clean up all the `isCustomConfig` tracking
This commit is contained in:
Sean Smith
2019-09-12 20:28:24 -04:00
parent 8cf50fe92c
commit 9f81207037
4 changed files with 9 additions and 27 deletions

View File

@@ -84,17 +84,12 @@ func WtfConfigDir() (string, error) {
}
// LoadWtfConfigFile loads the specified config file
func LoadWtfConfigFile(filePath string, isCustomConfig bool) *config.Config {
func LoadWtfConfigFile(filePath string) *config.Config {
absPath, _ := expandHomeDir(filePath)
cfg, err := config.ParseYamlFile(absPath)
if err != nil {
if isCustomConfig {
displayWtfCustomConfigFileLoadError(err)
} else {
displayWtfConfigFileLoadError(err)
}
displayWtfConfigFileLoadError(absPath, err)
os.Exit(1)
}