risingwave_errorTrait AsReport
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 Error
that provides a Report
which 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.
See the documentation for Report
for what the formatting looks
like under different options.
§Example
use thiserror::AsReport;
let error = fallible_action().unwrap_err();
println!("{}", error.as_report());
Converts the error to a Report
and formats it in a compact way.
This is equivalent to format!("{}", self.as_report())
.
§Example
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())
.
§Example
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())
.
§Example
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.
§Example
outer error
Caused by these errors (recent errors listed first):
1: middle error
2: inner error
Backtrace:
...