1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#[derive(Debug, thiserror::Error)]
pub enum AppError {
#[error("{0}")]
Cli(String),
#[error(transparent)]
Fatal(#[from] anyhow::Error),
}
impl AppError {
pub fn exit_code(&self) -> u8 {
match self {
Self::Cli(_) => 2,
Self::Fatal(_) => 1,
}
}
}