pub trait ErrorContext<T> {
// Required methods
fn context(self, message: impl Into<String>) -> Result<T, FraiseQLError>;
fn with_context<F, M>(self, f: F) -> Result<T, FraiseQLError>
where F: FnOnce() -> M,
M: Into<String>;
}Expand description
Extension trait for adding context to errors.
Required Methods§
Sourcefn context(self, message: impl Into<String>) -> Result<T, FraiseQLError>
fn context(self, message: impl Into<String>) -> Result<T, FraiseQLError>
Add context to an error.
§Errors
Returns Err if the original value was Err, wrapping it in an Internal error with the
given message.
Sourcefn with_context<F, M>(self, f: F) -> Result<T, FraiseQLError>
fn with_context<F, M>(self, f: F) -> Result<T, FraiseQLError>
Add context lazily (only computed on error).
§Errors
Returns Err if the original value was Err, wrapping it in an Internal error with the
context 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.