forked from wtfutil/wtf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror_messages.go
48 lines (39 loc) · 1.42 KB
/
error_messages.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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)
}