2025-04-27 08:36:57 +09:00
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
|
|
pub enum Error {
|
|
|
|
#[error("Parser error")]
|
|
|
|
Clap(#[from] clap::Error),
|
|
|
|
#[error("Parse int error")]
|
2025-05-03 11:17:38 +09:00
|
|
|
ParseInt(#[from] std::num::ParseIntError),
|
2025-04-27 08:36:57 +09:00
|
|
|
#[error("IO Error")]
|
2025-05-03 11:17:38 +09:00
|
|
|
Io(#[from] std::io::Error),
|
2025-05-02 08:57:43 +09:00
|
|
|
#[error("Parse toml error")]
|
|
|
|
TomlDe(#[from] toml::de::Error),
|
2025-05-03 11:17:38 +09:00
|
|
|
#[error("Missing config value: ({0})")]
|
|
|
|
MissingConfig(String)
|
|
|
|
|
2025-04-27 08:36:57 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Error {
|
|
|
|
pub fn print(&self) -> Result<(), Error> {
|
|
|
|
match self {
|
|
|
|
Error::Clap(x) => Ok(x.print()?),
|
|
|
|
_ => unimplemented!(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|