1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#[cfg(feature = "anyhow")]
impl crate::ExitCode for anyhow::Error {
fn exit_code(&self) -> i32 {
if let Some(err) = self.downcast_ref::<crate::CliError>() {
return err.exit_code();
}
#[cfg(feature = "error")]
if let Some(err) = self.downcast_ref::<crate::Error>() {
return err.exit_code();
}
exitcode::SOFTWARE
}
}
#[cfg(feature = "error")]
impl crate::ExitCode for crate::Error {
fn exit_code(&self) -> i32 {
self.inner.exit_code()
}
}
pub(crate) mod private {
pub trait Sealed {}
#[cfg(feature = "anyhow")]
impl Sealed for anyhow::Error {}
#[cfg(feature = "error")]
impl Sealed for crate::Error {}
impl Sealed for crate::CliError {}
}