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

Improved error message when no baseline version found on crates.io #183

Closed
obi1kenobi opened this issue Nov 15, 2022 · 3 comments · Fixed by #456
Closed

Improved error message when no baseline version found on crates.io #183

obi1kenobi opened this issue Nov 15, 2022 · 3 comments · Fixed by #456
Labels
A-cli Area: engine around the lints A-docs Area: documentation for the command and lints C-enhancement Category: raise the bar on expectations E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: Mentorship is available for this issue.

Comments

@obi1kenobi
Copy link
Owner

Right now, if attempting to semver-check a crate that doesn't have a version published on crates.io, the error message is terse and not helpful:

    Updating index
     Parsing foo_bar v0.1.0 (current)
Error: foo_bar not found in registry

Possible improvements:

Perhaps related to #146 as well.

@obi1kenobi obi1kenobi added A-cli Area: engine around the lints A-docs Area: documentation for the command and lints C-enhancement Category: raise the bar on expectations E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: Mentorship is available for this issue. labels Nov 15, 2022
@era
Copy link
Contributor

era commented May 25, 2023

Hi @obi1kenobi, I would like to give it a try. If I understood correctly the error you are mentioning comes from https://github.com/obi1kenobi/cargo-semver-checks/blob/main/src/rustdoc_gen.rs#L589, given need_retry I imagine the error is err.class() == git2::ErrorClass::Index && err.code() == git2::ErrorCode::NotFound.

And for what I see on the project, the errors bubble up to the main function and force the program to exit with the error message printed. If that is the case, would something like this be ok or you have something else in mind?

while need_retry(index.update()).map_err(human_readable_message)? {
            config.shell_status("Blocking", "waiting for lock on registry index")?;
            std::thread::sleep(REGISTRY_BACKOFF);
        }

@obi1kenobi
Copy link
Owner Author

I believe that's all correct and the approach seems sound. Go for it! Thanks for giving it a try 🙌

@era
Copy link
Contributor

era commented May 28, 2023

In the end, it was more simple because there is already a check if the crate is at crates.io, so I just modified the error message. If this is not enough I can go back to the previous solution we talked about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Area: engine around the lints A-docs Area: documentation for the command and lints C-enhancement Category: raise the bar on expectations E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: Mentorship is available for this issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants