pub trait ErrorContext<T> {
// Required methods
fn with_context_internal_error(
self,
message: impl FnOnce() -> String,
) -> Result<T, ApiError>;
fn with_context_bad_request(
self,
message: impl FnOnce() -> String,
) -> Result<T, ApiError>;
fn with_context_not_found(
self,
message: impl FnOnce() -> String,
) -> Result<T, ApiError>;
// Provided methods
fn context_internal_error(self, message: &str) -> Result<T, ApiError>
where Self: Sized { ... }
fn context_bad_request(self, message: &str) -> Result<T, ApiError>
where Self: Sized { ... }
fn context_not_found(self, message: &str) -> Result<T, ApiError>
where Self: Sized { ... }
}
Required Methods§
Sourcefn with_context_internal_error(
self,
message: impl FnOnce() -> String,
) -> Result<T, ApiError>
fn with_context_internal_error( self, message: impl FnOnce() -> String, ) -> Result<T, ApiError>
Make a new internal server error using the given function to create the message.
Provided Methods§
Sourcefn context_internal_error(self, message: &str) -> Result<T, ApiError>where
Self: Sized,
fn context_internal_error(self, message: &str) -> Result<T, ApiError>where
Self: Sized,
Make a new internal server error with the given 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.