From 33f4c76826cbd9b9f4094effb78943fb52da5574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Saparelli?= <felix@passcod.name> Date: Tue, 31 May 2022 23:01:45 +1200 Subject: [PATCH] Add help text for when a crate is not found --- src/errors.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index e6e4ab94..16f7233d 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -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]