pub struct ErrorContext {
pub operation: String,
pub error_message: String,
pub problematic_content: Option<String>,
pub metadata: HashMap<String, String>,
}Expand description
Context information captured when an error occurs
Fields§
§operation: StringThe operation that failed
error_message: StringError message
problematic_content: Option<String>The problematic content that caused the error
metadata: HashMap<String, String>Additional metadata
Implementations§
Source§impl ErrorContext
impl ErrorContext
Sourcepub fn new(
operation: impl Into<String>,
error_message: impl Into<String>,
) -> Self
pub fn new( operation: impl Into<String>, error_message: impl Into<String>, ) -> Self
Create a new error context
Sourcepub fn with_content(self, content: impl Into<String>) -> Self
pub fn with_content(self, content: impl Into<String>) -> Self
Add problematic content
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add metadata
Sourcepub fn to_detailed_string(&self) -> String
pub fn to_detailed_string(&self) -> String
Format the context as a human-readable string
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