ErrorContext

Trait ErrorContext 

Source
pub trait ErrorContext<T> {
    // Required method
    fn context_internal_error(
        self,
        message: impl Display,
    ) -> Result<T, ApiError>;

    // Provided method
    fn with_context_internal_error(
        self,
        message: impl FnOnce() -> String,
    ) -> Result<T, ApiError>
       where Self: Sized { ... }
}

Required Methods§

Source

fn context_internal_error(self, message: impl Display) -> Result<T, ApiError>

Make a new internal server error with the given message.

Provided Methods§

Source

fn with_context_internal_error( self, message: impl FnOnce() -> String, ) -> Result<T, ApiError>
where Self: Sized,

Make a new internal server error using the given function to create the message.

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.

Implementations on Foreign Types§

Source§

impl<T, E> ErrorContext<T> for Result<T, E>
where E: Error + 'static,

Source§

fn context_internal_error(self, message: impl Display) -> Result<T, ApiError>

Implementors§