1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Improve the error messaging around a mis-configured configuration file

This commit is contained in:
Chris Cummer 2019-06-30 20:59:16 -07:00
parent c6ab669edf
commit 9d38f5439d

View File

@ -126,8 +126,12 @@ func LoadConfigFile(filePath string) *config.Config {
cfg, err := config.ParseYamlFile(absPath)
if err != nil {
fmt.Println("\n\n\033[1m ERROR:\033[0m Could not load '\033[0;33mconfig.yml\033[0m'.\n Please add a \033[0;33mconfig.yml\033[0m file to your \033[0;33m~/.config/wtf\033[0m directory.\n See \033[1;34mhttps://github.com/wtfutil/wtf\033[0m for details.")
fmt.Printf(" %s\n", err.Error())
fmt.Println("\n\033[1mERROR:\033[0m Could not load '\033[0;33mconfig.yml\033[0m'.\n")
fmt.Println("This could mean one of two things:\n")
fmt.Println(" 1. Your \033[0;33mconfig.yml\033[0m file is missing. Check in \033[0;33m~/.config/wtf\033[0m to see if \033[0;33mconfig.yml\033[0m is there.")
fmt.Println(" 2. Your \033[0;33mconfig.yml\033[0m file has a syntax error. Try running it through http://www.yamllint.com to check for errors.")
fmt.Println()
fmt.Printf("Error: \033[0;31m%s\033[0m\n\n", err.Error())
os.Exit(1)
}