mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-01 17:50:03 +00:00
Verify that bin_files
exist in resolve
stage (#382)
* Refactor: Extract new fn `BinFile::check_source_exists` * Impl new async fn `AutoAbortJoinHandle::flattened_join` * Impl new fn `Fetcher::fetcher_name` * Verify that `bin_files` exist in `resolve` stage To ensure that the installation stage won't fail because of missing binaries. * Rm unused `MultiFecther` * Simplify `Future` impl for `AutoAbortJoinHandle` * Add new variant `BinstallError::CargoTomlMissingPackage` * Replace `unwrap` in `resolve_inner` with proper error handling * Make `Fetcher::new` as a regular function instead of an `async` function. * Ret `Arc<dyn Fetcher>` in trait fn `Fetcher::new` * Refactor `resolve_inner` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
7ac55c46f1
commit
fa79e7f105
8 changed files with 207 additions and 157 deletions
|
@ -276,6 +276,14 @@ pub enum BinstallError {
|
|||
#[diagnostic(severity(error), code(binstall::binfile))]
|
||||
BinFileNotFound(PathBuf),
|
||||
|
||||
/// `Cargo.toml` of the crate does not have section "Package".
|
||||
///
|
||||
/// - Code: `binstall::cargo_manifest`
|
||||
/// - Exit: 89
|
||||
#[error("Cargo.toml of crate {0} does not have section \"Package\"")]
|
||||
#[diagnostic(severity(error), code(binstall::cargo_manifest))]
|
||||
CargoTomlMissingPackage(CompactString),
|
||||
|
||||
/// A wrapped error providing the context of which crate the error is about.
|
||||
#[error("for crate {crate_name}")]
|
||||
CrateContext {
|
||||
|
@ -310,6 +318,7 @@ impl BinstallError {
|
|||
UnspecifiedBinaries => 86,
|
||||
NoViableTargets => 87,
|
||||
BinFileNotFound(_) => 88,
|
||||
CargoTomlMissingPackage(_) => 89,
|
||||
CrateContext { error, .. } => error.exit_number(),
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue