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

Export api.HTTPError #6

Merged
merged 3 commits into from
Dec 6, 2021
Merged

Conversation

sridharavinash
Copy link
Contributor

This is an attempt to fix the issue mentioned in #4.

With the change in here, api.HTTPError would be exported and it would allow the caller to the REST API client to do things like

client, _ := gh.RESTClient(options)
err := client.Get(blah)
if err != nil {
    httpError := err.(*api.HTTPError)
    if httpError.StatusCode == 502 {
            ...retry
     }else{
            ...do something else
      }
}

Thanks for the 👀 💖 .

@sridharavinash sridharavinash changed the title Export httperror Export api.HTTPError Dec 3, 2021
@samcoe samcoe self-requested a review December 6, 2021 09:53
@samcoe samcoe self-assigned this Dec 6, 2021
@samcoe
Copy link
Contributor

samcoe commented Dec 6, 2021

@sridharavinash Thanks for opening this! I made one commit to move the HTTPError out of the internal directory, my understanding is that Go automatically keeps anything in that directory from being exported outside the package so we needed to move the code out of there also.

@samcoe samcoe merged commit 8180ab7 into cli:trunk Dec 6, 2021
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