pub trait BackendError: Error + Sync {
    type ErrorType: Debug;

    // Required methods
    fn new(
        error_type: Self::ErrorType,
        message: String,
        source_error: Option<Error>
    ) -> Self;
    fn new_with_traces(
        error_type: Self::ErrorType,
        message: String,
        source_error: Option<Error>,
        backtrace: Backtrace,
        span_trace: SpanTrace
    ) -> Self;
    fn backtrace(&self) -> Option<&Backtrace>;
    fn error_type(&self) -> &Self::ErrorType;
    fn message(&self) -> &str;
    fn span_trace(&self) -> &SpanTrace;

    // Provided method
    fn to_different_error<T>(
        self,
        new_error_type: <T as BackendError>::ErrorType,
        new_message: String
    ) -> T
       where T: BackendError,
             Self: Sized + 'static + Send { ... }
}
Expand description

The error types of this program all implement this trait for interoperability.

Required Associated Types§

Required Methods§

source

fn new( error_type: Self::ErrorType, message: String, source_error: Option<Error> ) -> Self

source

fn new_with_traces( error_type: Self::ErrorType, message: String, source_error: Option<Error>, backtrace: Backtrace, span_trace: SpanTrace ) -> Self

source

fn backtrace(&self) -> Option<&Backtrace>

source

fn error_type(&self) -> &Self::ErrorType

source

fn message(&self) -> &str

source

fn span_trace(&self) -> &SpanTrace

Provided Methods§

source

fn to_different_error<T>( self, new_error_type: <T as BackendError>::ErrorType, new_message: String ) -> T
where T: BackendError, Self: Sized + 'static + Send,

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl BackendError for ModelError

§

type ErrorType = ModelErrorType

source§

fn new( error_type: <ModelError as BackendError>::ErrorType, message: String, source_error: Option<Error> ) -> ModelError

source§

fn backtrace(&self) -> Option<&Backtrace>

source§

fn error_type(&self) -> &<ModelError as BackendError>::ErrorType

source§

fn message(&self) -> &str

source§

fn span_trace(&self) -> &SpanTrace

source§

fn new_with_traces( error_type: <ModelError as BackendError>::ErrorType, message: String, source_error: Option<Error>, backtrace: Backtrace, span_trace: SpanTrace ) -> ModelError

Implementors§