From 9d38f5439d164c3bb0ca669499f03179a7e60191 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Sun, 30 Jun 2019 20:59:16 -0700 Subject: [PATCH] Improve the error messaging around a mis-configured configuration file --- cfg/config_files.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cfg/config_files.go b/cfg/config_files.go index 4bb00582..19f46ecf 100644 --- a/cfg/config_files.go +++ b/cfg/config_files.go @@ -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) }