This maybe a noob question but I've been googling for a while.
I am running in a for loop, for each loop a different api request
jiraClient, err := jira.NewClient(nil, *jiraURL)
if err != nil {
panic(err)
}
jiraClient.Authentication.SetBasicAuth(*jiraUser, string(jiraPass))
reader := csv.NewReader(*file)
CSVData, err := reader.ReadAll()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
lineCount := 1
for _, line := range data {
//reading CSV
//this returns 200 for all users found but 404 for not found
user, resp, _ := jiraClient.User.Get(user)
if resp.StatusCode == 200 {
fmt.Printf("Changed %s to %s
", user.Name, data.user)
} else {
// have tried continue, return
}
}
Every time it gets to a 404 response, the program fails and exits
I've tried a try and catch with no luck.
How can i have it continue?