Skip to main content

cargo_artifact_dependency/
error.rs

1use std::io;
2use std::path::PathBuf;
3
4use cargo_install::CargoInstallError;
5use thiserror::Error;
6
7/// Convenience result type for this crate.
8pub type Result<T> = std::result::Result<T, Error>;
9
10#[derive(Debug, Error)]
11/// Errors returned while resolving an artifact path.
12pub enum Error {
13    /// Local filesystem or process I/O failed.
14    #[error("i/o error: {0}")]
15    Io(#[from] io::Error),
16    /// Resolution failed while building or obtaining the artifact.
17    #[error(transparent)]
18    CargoInstallFailed(#[from] CargoInstallError),
19    /// More than one binary was available and no `bin_name` was provided.
20    #[error("multiple installed binaries found and no `bin_name` was provided")]
21    AmbiguousInstalledBinaries,
22    /// No binary artifacts were found.
23    #[error("no installed binaries found in `{dir}`")]
24    NoInstalledBinaries { dir: PathBuf },
25    /// The expected binary path was not present.
26    #[error("expected built artifact at `{}`", path.display())]
27    InvalidArtifactPath { path: PathBuf },
28}