currency_conversion_cli/errors.rs
1use anyhow::Result;
2
3/// Error handling function call in main
4#[cfg(not(tarpaulin_include))]
5pub fn errors_handling(error: anyhow::Error) -> Result<()> {
6 tracing::error!("{:#}", error);
7
8 // Return different exitcode depending on error type
9 if error.downcast_ref::<std::io::Error>().is_some() {
10 std::process::exit(exitcode::IOERR);
11 }
12
13 std::process::exit(1);
14}