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 reporting of HTTP request errors in fetchUpstreamArtifacthub() and fetchUpstreamHelmrepo() #39

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

adamkpickering
Copy link

No description provided.

@adamkpickering adamkpickering requested a review from a team as a code owner October 30, 2024 21:14
return chartSourceMeta, err
return chartSourceMeta, fmt.Errorf("request to %s failed: %w", url, err)
}
if resp.StatusCode >= 300 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does every 2xx code work? Even something like 204 No Content?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this makes it work. I'm not sure what to do if we have to worry about specific 2xx codes. FWIW, this is a GET request, so I don't think we'll ever get a 204. I'd say that the chance of getting a 2xx that is not a 200 is quite low.

The general idea is to catch the cases where the server has been moved, or taken down. Even capturing 4xx and 5xx codes is probably sufficient for this, given that http.Get() follows a limited number of redirects.

How would you suggest we proceed? I'm open to ideas 😄

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding a log when we get an error code that is not 200 would suffice. If it happens a lot, then we can think of how to fix it

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