From 2794a9038b18fe1d38ede02ff7ec8d0b66e28064 Mon Sep 17 00:00:00 2001 From: Slug-Boi Date: Mon, 13 Jan 2025 15:57:24 +0100 Subject: [PATCH] fix: rewrite error messages for error in author file to be more descriptive --- src/cmd/utils/user_util.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/cmd/utils/user_util.go b/src/cmd/utils/user_util.go index 92ffb04..033c189 100644 --- a/src/cmd/utils/user_util.go +++ b/src/cmd/utils/user_util.go @@ -2,6 +2,7 @@ package utils import ( "bufio" + "fmt" "os" "strings" ) @@ -47,11 +48,19 @@ func Define_users(author_file string) { info := strings.Split(input_str, "|") if len(info) < 4 { if len(info) > 0 { - println("Error: User ", info[0], " is missing information") + if info[0] == "" { + info[0] = "(empty string)" + } + fmt.Println("Error: User", info[0], "is missing information") + } else { + fmt.Println("Error: Some user is missing information") + } + fmt.Println("Please check the author file for proper syntax") + if input_str == "" { + fmt.Println("empty line found in author file") } else { - println("Error: Some user is missing information") + fmt.Println("author file input:", input_str) } - println("Please check the author file for proper syntax") os.Exit(1) } usr := User{Username: info[2], Email: info[3], Names: info[0] + "/" + info[1]}