risingwave_common::error

Trait 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.

Required Methods§

fn as_report(&self) -> Report<'_>

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());

Provided Methods§

fn to_report_string(&self) -> String

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

fn to_report_string_with_backtrace(&self) -> String

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:
  ...

fn to_report_string_pretty(&self) -> String

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

fn to_report_string_pretty_with_backtrace(&self) -> String

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:
  ...

Implementations on Foreign Types§

§

impl AsReport for dyn Error

§

fn as_report(&self) -> Report<'_>

§

impl AsReport for dyn Error + Send

§

fn as_report(&self) -> Report<'_>

§

impl AsReport for dyn Error + Sync

§

fn as_report(&self) -> Report<'_>

§

impl AsReport for dyn Error + Sync + Send

§

fn as_report(&self) -> Report<'_>

§

impl AsReport for dyn Error + UnwindSafe + Sync + Send

§

fn as_report(&self) -> Report<'_>

Implementors§

§

impl<T> AsReport for T
where T: Error,