Skip to main content

ErrorContext

Trait ErrorContext 

Source
pub trait ErrorContext<T> {
    // Required methods
    fn with_context(self, context: &str) -> Result<T>;
    fn with_context_lazy<F>(self, f: F) -> Result<T>
       where F: FnOnce() -> String;
}
Expand description

Trait for adding context to errors

Required Methods§

Source

fn with_context(self, context: &str) -> Result<T>

Add context to an error

Source

fn with_context_lazy<F>(self, f: F) -> Result<T>
where F: FnOnce() -> String,

Add context using a closure

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T, E> ErrorContext<T> for Result<T, E>
where E: Into<GraphRAGError>,

Source§

fn with_context(self, context: &str) -> Result<T>

Source§

fn with_context_lazy<F>(self, f: F) -> Result<T>
where F: FnOnce() -> String,

Implementors§