Skip to main content

cargo_declared/
error.rs

1use std::path::PathBuf;
2
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5    #[error("Path does not exist: {path}")]
6    PathNotFound { path: PathBuf },
7
8    #[error("Failed to run cargo metadata: {source}")]
9    CargoMetadata {
10        #[from]
11        source: cargo_metadata::Error,
12    },
13
14    #[error("Cargo metadata did not identify a root package")]
15    NoRootPackage,
16
17    #[error("Failed to serialize JSON output: {source}")]
18    Json {
19        #[from]
20        source: serde_json::Error,
21    },
22}
23
24pub type Result<T> = std::result::Result<T, Error>;