Skip to main content

inherit_core/
error.rs

1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum InheritError {
6    #[error("IO error: {0}")]
7    Io(#[from] std::io::Error),
8
9    #[error("Manifest `{0}` not found in template")]
10    ManifestNotFound(PathBuf),
11
12    #[error("Failed to parse manifest: {0}")]
13    ManifestParse(#[from] toml::de::Error),
14
15    #[error("The following required variables are missing: {0:?}")]
16    MissingVariables(Vec<String>),
17
18    #[error("Invalid variable name `{0}` in manifest")]
19    InvalidVariable(String),
20
21    #[error("Command `{cmd}` failed with status {status}")]
22    CommandFailed {
23        cmd: String,
24        status: std::process::ExitStatus,
25    },
26
27    #[error("kissreplace error: {0}")]
28    KissReplace(#[from] kissreplace::KissReplaceError),
29}
30
31pub type Result<T> = std::result::Result<T, InheritError>;