Add help text for when a crate is not found

This commit is contained in:
Félix Saparelli 2022-05-31 23:01:45 +12:00
parent 84ebc0039e
commit 33f4c76826
No known key found for this signature in database
GPG key ID: B948C4BAE44FC474

View file

@ -1,7 +1,7 @@
use std::process::{ExitCode, Termination};
use log::warn;
use miette::{Report, Diagnostic};
use miette::{Diagnostic, Report};
use thiserror::Error;
/// Errors emitted by the library portion of cargo-binstall.
@ -76,7 +76,10 @@ pub enum BinstallError {
///
/// - Exit code: 76
#[error("crates.io api error fetching crate information for '{crate_name}': {err}")]
#[diagnostic(code(binstall::crates_io_api))]
#[diagnostic(
code(binstall::crates_io_api),
help("Check that the crate name you provided is correct.\nYou can also search for a matching crate at: https://lib.rs/search?q={crate_name}")
)]
CratesIoApi {
crate_name: String,
#[source]