-
-
Notifications
You must be signed in to change notification settings - Fork 18
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 message when the repo is not found #128
Comments
The plan looks great to me! 👍🏻 So it makes sense to minimise the total number of requests as much as possible. I agree that it can be unavoidable sometimes to provide better UX but still. My alternative proposal would be to submit a separate request to GitHub only if the
? |
@chshersh thanks, it makes sense. Regarding the different results - Github API always returns 404 with {
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest/reference/repos#get-the-latest-release"
} no matter if you mistyped the repo or the tag. I've also checked that on the repo with no releases and the latest tag, and got exactly the same error, so we won't be able to identify the reason based on the I believe it would be a rare case when somebody wants to fetch a repo that has no releases at all, so we might want to avoid that check\separate request if the I propose to do it this way then: If
This way, we wouldn't make any additional requests, and also partially cover this #69 issue until we figure out something better. |
@crudiedo This sounds excellent to me 💯 And thanks for checking how the API works 👍🏻 My only suggestion is for the error message when the tag is -The Repo is not available, please make sure the owner and repo are correct
+The {owner}/{repo} doesn't exist or has no releases. In theory, we could output a better error message when we see a |
…135) Resolves #128 This PR adds a new error `RepoError::NotFound` and uses it when fetch_release_info returns 404. The error message depends on the tag, and could be either ❌ **bottom** The clementtsang/bottomx doesn't exist or tags/0.66.3 was not found. or ❌ **bottom** The clementtsang/bottomx doesn't exist or has no releases. if the tag is latest. ### Additional tasks - [ ] Documentation for changes provided/changed - [ ] Tests added - [x] Updated CHANGELOG.md
Currently, if we mistype owner/repo in the conf file, we get this error:
It looks a bit confusing for the user since it looks like something tags\releases related.
I propose to:
RepoError::NotFound(owner, repo)
error and implementfmt::Display
for it (something like "Repo {owner}/{repo} is not found, please check if it's available")head
request tohttps://api.github.com/repos/{owner}/{repo}
before callingfetch_release_info
ureq::Error::Status(404, _)
on the head request above and showRepoError
insteadI believe this would also work for the repos that got deleted.
The text was updated successfully, but these errors were encountered: