pub trait ErrorExt: Sized {
// Required methods
fn into_eyre(self) -> Report;
fn into_status(self) -> Status;
}
Expand description
Extension traits for errors to easily convert them to eyre::Report and tonic::Status through BridgeError.
Required Methods§
Sourcefn into_eyre(self) -> Report
fn into_eyre(self) -> Report
Converts the error into an eyre::Report, first wrapping in BridgeError if necessary. It does not rewrap in eyre::Report if the given error is already an eyre::Report.
Sourcefn into_status(self) -> Status
fn into_status(self) -> Status
Converts the error into a tonic::Status. Currently defaults to
tonic::Status::from_error which will walk the error chain and attempt to
find a tonic::Status
in the chain. If it can’t find one, it will
return an Status::unknown with the Display representation of the error.
TODO: We should change the implementation to walk the chain of errors
and return the first TryInto<tonic::Status>
error. This is
impossible to do dynamically, each error must be included in the match
arms of the conversion logic.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.