Skip to content

Commit

Permalink
improve err handling;
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrizhu committed Jul 29, 2024
1 parent 1f23b54 commit b6e5e09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lg.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ func (p *Prefix) checkLGState() {
resp, err := http.Get(url)
if err != nil {
log.Error().Err(err).Msg("Fetching ripestat")
return
}

body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Error().Err(err).Msg("reading ripestat resp")
return
}
defer resp.Body.Close()

Expand All @@ -55,6 +57,7 @@ func (p *Prefix) checkLGState() {
log.Error().Int("status code", statusCode).
Str("status", ripeStatLookingGlassResp.Status).
Msg("ripestat(lg) resp status code != 200")
return
}

availableStr := "y"
Expand Down
3 changes: 3 additions & 0 deletions vis.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ func (p *Prefix) checkVisState() {
resp, err := http.Get(url)
if err != nil {
log.Error().Err(err).Msg("Fetching ripestat")
return
}

body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Error().Err(err).Msg("reading ripestat resp")
return
}
defer resp.Body.Close()

Expand All @@ -40,6 +42,7 @@ func (p *Prefix) checkVisState() {
log.Error().Int("status code", statusCode).
Str("status", ripeStatVisibilityResp.Status).
Msg("ripestat(vis) resp status code != 200")
return
}

ipv6 := strings.Contains(p.prefix, ":")
Expand Down

0 comments on commit b6e5e09

Please sign in to comment.