intentional_core/
error.rs1use std::path::PathBuf;
9
10pub type Result<T> = std::result::Result<T, Error>;
12
13#[derive(Debug, thiserror::Error)]
15pub enum Error {
16 #[error(
18 ".intentional/config.yml uses contract-1, which this version of intentional does not load; run `intentional init` to upgrade it to contract-2"
19 )]
20 ContractUpgradeRequired,
21
22 #[error("validation failed: {0}")]
24 Validation(String),
25
26 #[error("failed to access {path}: {source}")]
28 Io {
29 path: PathBuf,
31 source: std::io::Error,
33 },
34
35 #[error("invalid YAML: {0}")]
37 Yaml(#[from] serde_yaml::Error),
38
39 #[error("git operation failed: {0}")]
41 Git(String),
42
43 #[error("invalid semantic version: {0}")]
45 Semver(#[from] semver::Error),
46}
47
48impl Error {
49 pub(crate) fn io(path: impl Into<PathBuf>, source: std::io::Error) -> Self {
51 Self::Io {
52 path: path.into(),
53 source,
54 }
55 }
56}