pub struct ErrorContext {
pub category: &'static str,
pub details: Vec<(String, String)>,
pub file_path: Option<PathBuf>,
pub operation: Option<String>,
pub parameters: HashMap<String, String>,
pub custom_suggestion: Option<String>,
}Expand description
Additional context information for errors
Fields§
§category: &'static strError category for grouping similar errors
details: Vec<(String, String)>Additional details about the error
file_path: Option<PathBuf>File path associated with the error (if any)
operation: Option<String>Operation name that failed (if any)
parameters: HashMap<String, String>Parameter values relevant to the error
custom_suggestion: Option<String>Custom suggestion overriding the default (if any)
Implementations§
Source§impl ErrorContext
impl ErrorContext
Sourcepub fn with_detail(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_detail( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a detail to the context
Sourcepub fn with_operation(self, operation: String) -> Self
pub fn with_operation(self, operation: String) -> Self
Set the operation name
Sourcepub fn with_parameter(self, key: String, value: String) -> Self
pub fn with_parameter(self, key: String, value: String) -> Self
Add a parameter
Sourcepub fn with_custom_suggestion(self, suggestion: String) -> Self
pub fn with_custom_suggestion(self, suggestion: String) -> Self
Set a custom suggestion
Trait Implementations§
Source§impl Clone for ErrorContext
impl Clone for ErrorContext
Source§fn clone(&self) -> ErrorContext
fn clone(&self) -> ErrorContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ErrorContext
impl RefUnwindSafe for ErrorContext
impl Send for ErrorContext
impl Sync for ErrorContext
impl Unpin for ErrorContext
impl UnsafeUnpin for ErrorContext
impl UnwindSafe for ErrorContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more