1#[derive(Debug)]
6pub enum ProjectError {
7 NoManifest,
8 InvalidManifest(String),
9 Multiple(Vec<Self>),
10 HclError(hcl::error::Error),
11 Other(String),
12}
13
14impl From<hcl::error::Error> for ProjectError {
15 fn from(e: hcl::error::Error) -> Self {
16 Self::HclError(e)
17 }
18}
19
20impl std::fmt::Display for ProjectError {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 match self {
23 Self::NoManifest => write!(f, "No manifest found"),
24 Self::InvalidManifest(e) => write!(f, "Invalid manifest: {e}"),
25 Self::Other(msg) => write!(f, "{msg}"),
26 Self::HclError(e) => write!(f, "Error parsing HCL: {e}"),
27 Self::Multiple(errors) => {
28 write!(f, "Multiple errors:")?;
29 for error in errors {
30 write!(f, "\n - {error}")?;
31 }
32 Ok(())
33 }
34 }
35 }
36}
37
38impl std::error::Error for ProjectError {}