github.com/wtfutil/wtf@v0.43.0/cfg/error_messages.go (about) 1 package cfg 2 3 // This file contains the error messages that get written to the terminal when 4 // something goes wrong with the configuration process. 5 // 6 // As a general rule, if one of these has to be shown the app should then die 7 // via os.Exit(1) 8 9 import ( 10 "fmt" 11 12 "github.com/logrusorgru/aurora/v4" 13 ) 14 15 /* -------------------- Unexported Functions -------------------- */ 16 17 func displayError(err error) { 18 fmt.Printf("%s %s\n\n", aurora.Red("Error:"), err.Error()) 19 } 20 21 func displayDefaultConfigCreateError(err error) { 22 fmt.Printf("\n%s Could not create the default configuration file.\n", aurora.Red("ERROR")) 23 fmt.Println() 24 displayError(err) 25 } 26 27 func displayDefaultConfigWriteError(err error) { 28 fmt.Printf("\n%s Could not write the default configuration file.\n", aurora.Red("ERROR")) 29 fmt.Println() 30 displayError(err) 31 } 32 33 func displayWtfConfigDirCreateError(err error) { 34 fmt.Printf("\n%s Could not create the '%s' directory.\n", aurora.Red("ERROR"), aurora.Yellow(WtfConfigDirV2)) 35 fmt.Println() 36 displayError(err) 37 } 38 39 func displayWtfConfigFileLoadError(path string, err error) { 40 fmt.Printf("\n%s Could not load '%s'.\n", aurora.Red("ERROR"), aurora.Yellow(path)) 41 fmt.Println() 42 fmt.Println("This could mean one of two things:") 43 fmt.Println() 44 fmt.Println(" 1. That file doesn't exist.") 45 fmt.Println(" 2. That file has a YAML syntax error. Try running it through http://www.yamllint.com to check for errors.") 46 fmt.Println() 47 displayError(err) 48 }