Skip to content

Commit

Permalink
Retry when the server returns an error
Browse files Browse the repository at this point in the history
  • Loading branch information
qu35t-code committed Jan 19, 2024
1 parent f59920b commit cfc43eb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/vpn/vpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ func downloadVPN(url string) error {
return nil
}

if resp.StatusCode == 500 {
fmt.Println("The server returned an error. New attempt to download the VPN.")
downloadVPN(url)

Check failure on line 36 in lib/vpn/vpn.go

View workflow job for this annotation

GitHub Actions / lint

Error return value is not checked (errcheck)
}

if resp.StatusCode != http.StatusOK {
return fmt.Errorf("error: Bad status code : %d", resp.StatusCode)
}
Expand Down

0 comments on commit cfc43eb

Please sign in to comment.