feat: improved error messages

This commit is contained in:
Simon Cornet 2025-03-04 14:10:56 +01:00
commit 0e388f04ae
4 changed files with 10 additions and 10 deletions

View file

@ -45,7 +45,7 @@ func checkoutRepositories(repositories []Repository) {
}
_, err := cloneRepository(repoDestination, url)
if err != nil {
log.Printf("error: %v\n", err)
log.Printf("ERROR: %v\n", err)
}
clonedCount = clonedCount + 1
progressBarAdd(1)
@ -56,8 +56,8 @@ func checkoutRepositories(repositories []Repository) {
progressBarAdd(1)
default:
log.Printf("error: decided not to clone or pull repository %v\n", repoName)
log.Printf("error: this is why: %v\n", repoStatus)
log.Printf("ERROR: decided not to clone or pull repository %v\n", repoName)
log.Printf("ERROR: this is why: %v\n", repoStatus)
errorCount = errorCount + 1
progressBarAdd(1)
}
@ -98,7 +98,7 @@ func pullRepository(repoName string, repoDestination string) {
pullErrorMsg = append(pullErrorMsg, repoDestination)
default:
log.Printf("error: pulling %v\n", err)
log.Printf("ERROR: pulling %v\n", err)
}
}
}

View file

@ -29,7 +29,7 @@ func manageArguments() {
gitlabToken = envToken
default:
flag.Usage()
log.Printf("fatal: config; gitlab api token not found\n")
log.Printf("FATAL: config; gitlab api token not found\n")
}
// manage gitlab url option
@ -38,7 +38,7 @@ func manageArguments() {
gitlabHost = envHost
default:
flag.Usage()
log.Fatalf("fatal: config; gitlab host not found\n")
log.Fatalf("FATAL: config; gitlab host not found\n")
}
// manage destination option
@ -47,7 +47,7 @@ func manageArguments() {
repoDestinationPre = envRepoDest
default:
flag.Usage()
log.Fatalf("fatal: config; destination not found\n")
log.Fatalf("FATAL: config; destination not found\n")
}
// add slash 🎩🎸 if not provided
@ -72,6 +72,6 @@ func manageArguments() {
default:
flag.Usage()
log.Fatalf("fatal: config; no or wrong archive option found\n")
log.Fatalf("FATAL: config; no or wrong archive option found\n")
}
}

View file

@ -31,7 +31,7 @@ func main() {
// fetch repository information from gitlab
repositories, err := fetchRepositoriesGitlab()
if err != nil {
log.Fatalf("fatal: %v", err)
log.Fatalf("FATAL: %v", err)
}
// manage found repositories

View file

@ -41,7 +41,7 @@ func progressBar(repositories []Repository) {
func progressBarAdd(amount int) {
if err := bar.Add(amount); err != nil {
log.Printf("Progress bar update error: %v\n", err)
log.Printf("ERROR: Progress bar update error: %v\n", err)
}
}