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

Remove another panic call

This commit is contained in:
Chris Cummer 2019-08-03 12:27:38 -07:00
parent 7b4c77b7da
commit b9d1017754
2 changed files with 9 additions and 2 deletions

View File

@ -152,7 +152,8 @@ func createWtfConfigDir() {
func createWtfConfigFile() {
filePath, err := CreateFile(WtfConfigFile)
if err != nil {
panic(err)
displayDefaultConfigCreateError(err)
os.Exit(1)
}
// If the file is empty, write to it

View File

@ -18,8 +18,14 @@ 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.\n", aurora.Red("ERROR"))
fmt.Printf("\n%s Could not write the default configuration file.\n", aurora.Red("ERROR"))
fmt.Println()
displayError(err)
}