|
|
|
@ -15,6 +15,8 @@ pub enum Error { |
|
|
|
|
SerdeToml(#[cause] toml::de::Error), |
|
|
|
|
#[fail(display = "{}. stderr:\n\n{}", message, stderr)] |
|
|
|
|
Cli { message: String, stderr: String }, |
|
|
|
|
#[fail(display = "{}", message)] |
|
|
|
|
CrateConfig { message: String }, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
impl Error { |
|
|
|
@ -25,6 +27,12 @@ impl Error { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn crate_config(message: &str) -> Result<(), Self> { |
|
|
|
|
Err(Error::CrateConfig { |
|
|
|
|
message: message.to_string(), |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn error_type(&self) -> String { |
|
|
|
|
match self { |
|
|
|
|
Error::Io(_) => "There was an I/O error. Details:\n\n", |
|
|
|
@ -34,6 +42,9 @@ impl Error { |
|
|
|
|
message: _, |
|
|
|
|
stderr: _, |
|
|
|
|
} => "There was an error while calling another CLI tool. Details:\n\n", |
|
|
|
|
Error::CrateConfig { message: _ } => { |
|
|
|
|
"There was a crate configuration error. Details:\n\n" |
|
|
|
|
} |
|
|
|
|
}.to_string() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|