Skip to content

Commit

Permalink
better error handling in fetch log
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacsjep committed Jan 25, 2025
1 parent 2a29db5 commit 72773ff
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,23 @@ func getLog(url string, pwd string) {

resp, err := client.Get(url)
if err != nil {
log.Println(err)
log.Printf("FETCH LOG ERROR: %s", err)
return
}

if resp.StatusCode == 401 {
log.Println("FETCH LOG ERROR: Unauthorized, either the password is incorrect or the camera does not support digest auth -> check root.Network.HTTP.AuthenticationPolicy via https://<ip>/axis-cgi/param.cgi?action=list, should be set to digest")
return
}

if resp.StatusCode != 200 {
log.Printf("FETCH LOG ERROR: %s", resp.Status)
return
}

body, err := io.ReadAll(resp.Body)
if err != nil {
log.Println(err)
log.Printf("FETCH LOG ERROR: %s", err)
return
}

Expand Down

0 comments on commit 72773ff

Please sign in to comment.