pub trait AsReport: Sealed {
// Required method
fn as_report(&self) -> Report<'_>;
// Provided methods
fn to_report_string(&self) -> String { ... }
fn to_report_string_with_backtrace(&self) -> String { ... }
fn to_report_string_pretty(&self) -> String { ... }
fn to_report_string_pretty_with_backtrace(&self) -> String { ... }
}
Expand description
Extension trait for std::error::Error
that provides a Report
that formats the error and its sources in a cleaned-up way.
Returns a Report
that formats the error and its sources in a
cleaned-up way.
Converts the error to a Report
and formats it in a compact way.
This is equivalent to format!("{}", self.as_report())
.
outer error: middle error: inner error
Converts the error to a Report
and formats it in a compact way,
including backtraces if available.
This is equivalent to format!("{:?}", self.as_report())
.
outer error: middle error: inner error
Backtrace:
...
Converts the error to a Report
and formats it in a pretty way.
This is equivalent to format!("{:#}", self.as_report())
.
outer error
Caused by these errors (recent errors listed first):
1: middle error
2: inner error
Converts the error to a Report
and formats it in a pretty way,
including backtraces if available.
outer error
Caused by these errors (recent errors listed first):
1: middle error
2: inner error
Backtrace:
...