Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling in verifyConn #13

Merged
merged 1 commit into from
Apr 28, 2021
Merged

Improve error handling in verifyConn #13

merged 1 commit into from
Apr 28, 2021

Conversation

ribbybibby
Copy link
Contributor

  • Avoid a panic when the http.Get resp is nil by returning the error before deferring resp.Body.Close()
  • http.Get will not return an error for non-2xx response codes, so check the response code explicitly and return an error when it isn't the expected 200 response
  • Return the error from ioutil.ReadAll
  • Use fmt.Errorf across the board
  • Include the caURL in the error messages to hopefully make the source of errors clearer up the stack

- Avoid a panic when the http.Get resp is nil by returning the error
  before deferring resp.Body.Close()
- http.Get will not return an error for non-2xx response codes, so check
  the response code explicitly and return an error when it isn't the
  expected 200 response
- Return the error from ioutil.ReadAll
- Use fmt.Errorf across the board
- Include the caURL in the error messages to hopefully make the source
  of errors clearer up the stack
@ribbybibby ribbybibby merged commit 0b2ef93 into main Apr 28, 2021
@ribbybibby ribbybibby deleted the ca-cert-err branch April 28, 2021 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants