pub struct EnhancedError {
pub error: UtilsError,
pub context: Vec<String>,
pub stack_trace: Vec<String>,
pub timestamp: SystemTime,
pub error_id: String,
pub metadata: HashMap<String, String>,
}Expand description
Enhanced error with context and stack trace information
Fields§
§error: UtilsError§context: Vec<String>§stack_trace: Vec<String>§timestamp: SystemTime§error_id: String§metadata: HashMap<String, String>Implementations§
Source§impl EnhancedError
impl EnhancedError
Sourcepub fn new(error: UtilsError) -> Self
pub fn new(error: UtilsError) -> Self
Create a new enhanced error
Sourcepub fn with_context<S: Into<String>>(self, context: S) -> Self
pub fn with_context<S: Into<String>>(self, context: S) -> Self
Add context to the error
Sourcepub fn with_metadata<K: Into<String>, V: Into<String>>(
self,
key: K,
value: V,
) -> Self
pub fn with_metadata<K: Into<String>, V: Into<String>>( self, key: K, value: V, ) -> Self
Add metadata to the error
Sourcepub fn format_detailed(&self) -> String
pub fn format_detailed(&self) -> String
Format the error for display
Trait Implementations§
Source§impl Clone for EnhancedError
impl Clone for EnhancedError
Source§fn clone(&self) -> EnhancedError
fn clone(&self) -> EnhancedError
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 moreSource§impl Debug for EnhancedError
impl Debug for EnhancedError
Source§impl Display for EnhancedError
impl Display for EnhancedError
Source§impl Error for EnhancedError
impl Error for EnhancedError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for EnhancedError
impl RefUnwindSafe for EnhancedError
impl Send for EnhancedError
impl Sync for EnhancedError
impl Unpin for EnhancedError
impl UnwindSafe for EnhancedError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more