hermod_api/services/
error.rs

1//! Contains methods useful for error handling.
2
3/// Writes a chain of error causes to a formatter
4pub fn error_chain_fmt(
5    e: &impl std::error::Error,
6    f: &mut std::fmt::Formatter<'_>,
7) -> std::fmt::Result {
8    writeln!(f, "{}\n", e)?;
9    let mut current = e.source();
10    while let Some(cause) = current {
11        writeln!(f, "Caused by:\n\t{}", cause)?;
12        current = cause.source();
13    }
14    Ok(())
15}