pub fn format_error(
err: &dyn Error,
name: Option<&str>,
backtrace: Option<&Backtrace>,
) -> String
Expand description
Helper function for formatting an error as a string containing a human-readable chain of causes.
This function will walk over the chain of causes returned by
Error::source
and append each underlying error (using the
Display
trait).
ยงArguments
err
- Error to format.name
- Optional name of the error type/variant (e.g.,EventError::InvalidBodyJson
).backtrace
- OptionalBacktrace
indicating where the top-level error occurred.