-
Notifications
You must be signed in to change notification settings - Fork 153
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
Panic when crate not found #209
Comments
I wasn't able to reproduce the panic neither with
As for the unhelpful message, we should fix it (@bjgill I thought #200 was supposed to fix this?). |
Thanks for the report. It looks like what you're seeing is the expected output from attempting to add a crate that doesn't actually exist whilst having backtrace enabled.
If this is indeed the case, whilst expected, this is nonetheless a self-evidently poor user experience. I think there are probably a couple of things we could/should do:
(as I remember, #200 only prevented us from hitting that error in the specific case where you were trying to upgrade a path dependency. I don't think it did anything to improve handling of the general error case of attempting to add a non-existent crate) |
@bjgill yes I indeed have I think it's a reasonable to assume that a lot of developers using cargo-edit have it set, so your PR is appreciated. |
210: Add specific error for a missing crate r=ordian a=bjgill The new error message is: ``` $ cargo add lets_hope_nobody_ever_publishes_a_crate_with_this_name Command failed due to unhandled error: The crate `lets_hope_nobody_ever_publishes_a_crate_with_this_name` could not be found on crates.io. Caused by: https://crates.io/api/v1/crates/lets_hope_nobody_ever_publishes_a_crate_with_this_name: Client Error: 404 Not Found ``` This is a partial fix for #209 (doesn't sort out the backtrace issue). This PR also ensures that we catch errors when fetching from crates.io correctly. Previously, we only noticed if the JSON was in an unexpected format. Now, we check the status of the response first. Also bumps the rustfmt version to the version shipped with stable 1.25.0. Co-authored-by: Benjamin Gill <[email protected]>
I think this can now be closed. |
Just upgrade my nightly to (4b9b70c39 2018-04-09), and it seems that
cargo-add
does not handle non-existant crates gracefully anymore.I mistyped a crate (
serde_dervie
) and got this error:The text was updated successfully, but these errors were encountered: