pub struct RecoverableError {
pub error: CoreError,
pub strategy: RecoveryStrategy,
pub hints: Vec<RecoveryHint>,
pub retryable: bool,
pub severity: ErrorSeverity,
pub metadata: HashMap<String, String>,
}
Expand description
Enhanced error with recovery capabilities
Fields§
§error: CoreError
The original error
strategy: RecoveryStrategy
Suggested recovery strategy
hints: Vec<RecoveryHint>
Recovery hints for the user
retryable: bool
Whether this error is retryable
severity: ErrorSeverity
Error severity level
metadata: HashMap<String, String>
Additional metadata about the error
Implementations§
Source§impl RecoverableError
impl RecoverableError
Sourcepub fn with_strategy(self, strategy: RecoveryStrategy) -> Self
pub fn with_strategy(self, strategy: RecoveryStrategy) -> Self
Create a recoverable error with custom strategy
Sourcepub fn with_hint(self, hint: RecoveryHint) -> Self
pub fn with_hint(self, hint: RecoveryHint) -> Self
Add a recovery hint
Sourcepub fn with_metadata<K, V>(self, key: K, value: V) -> Self
pub fn with_metadata<K, V>(self, key: K, value: V) -> Self
Add metadata to the error
Sourcepub fn with_severity(self, severity: ErrorSeverity) -> Self
pub fn with_severity(self, severity: ErrorSeverity) -> Self
Set error severity
Sourcepub fn recovery_report(&self) -> String
pub fn recovery_report(&self) -> String
Get a user-friendly error report with recovery suggestions
Trait Implementations§
Source§impl Clone for RecoverableError
impl Clone for RecoverableError
Source§fn clone(&self) -> RecoverableError
fn clone(&self) -> RecoverableError
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 RecoverableError
impl Debug for RecoverableError
Source§impl Display for RecoverableError
impl Display for RecoverableError
Source§impl Error for RecoverableError
impl Error for RecoverableError
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 RecoverableError
impl RefUnwindSafe for RecoverableError
impl Send for RecoverableError
impl Sync for RecoverableError
impl Unpin for RecoverableError
impl UnwindSafe for RecoverableError
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