1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
wtf/cfg/error_messages.go
Chris Cummer 9cd9a58759 Fix a bunch of minor issues found by running staticcheck
Signed-off-by: Chris Cummer <chriscummer@me.com>
2020-05-06 22:44:24 -07:00

49 lines
1.4 KiB
Go

package cfg
// This file contains the error messages that get written to the terminal when
// something goes wrong with the configuration process.
//
// As a general rule, if one of these has to be shown the app should then die
// via os.Exit(1)
import (
"fmt"
"github.com/logrusorgru/aurora"
)
/* -------------------- Unexported Functions -------------------- */
func displayError(err error) {
fmt.Printf("%s %s\n\n", aurora.Red("Error:"), err.Error())
}
func displayDefaultConfigCreateError(err error) {
fmt.Printf("\n%s Could not create the default configuration file.\n", aurora.Red("ERROR"))
fmt.Println()
displayError(err)
}
func displayDefaultConfigWriteError(err error) {
fmt.Printf("\n%s Could not write the default configuration file.\n", aurora.Red("ERROR"))
fmt.Println()
displayError(err)
}
func displayWtfConfigDirCreateError(err error) {
fmt.Printf("\n%s Could not create the '%s' directory.\n", aurora.Red("ERROR"), aurora.Yellow(WtfConfigDirV2))
fmt.Println()
displayError(err)
}
func displayWtfConfigFileLoadError(path string, err error) {
fmt.Printf("\n%s Could not load '%s'.\n", aurora.Red("ERROR"), aurora.Yellow(path))
fmt.Println()
fmt.Println("This could mean one of two things:")
fmt.Println()
fmt.Println(" 1. That file doesn't exist.")
fmt.Println(" 2. That file has a YAML syntax error. Try running it through http://www.yamllint.com to check for errors.")
fmt.Println()
displayError(err)
}