pub struct BackendError {
pub kind: BackendErrorKind,
pub message: String,
pub retryable: bool,
}Expand description
Error from any backend operation.
This is the universal error type for all backends. It captures the error kind, a human-readable message, and whether the operation can be retried.
§Retryable Errors
Some errors are transient (network issues, rate limits) and can be retried.
Use is_retryable() to check.
§Example
use converge_provider::{BackendError, BackendErrorKind};
let err = BackendError::new(BackendErrorKind::Timeout, "operation timed out");
assert!(err.is_retryable());
let err = BackendError::new(BackendErrorKind::InvalidRequest, "missing field");
assert!(!err.is_retryable());Fields§
§kind: BackendErrorKindError category.
message: StringHuman-readable description.
retryable: boolWhether this operation can be retried.
Implementations§
Source§impl BackendError
impl BackendError
Sourcepub fn new(kind: BackendErrorKind, message: impl Into<String>) -> Self
pub fn new(kind: BackendErrorKind, message: impl Into<String>) -> Self
Creates a new backend error with automatic retryable detection.
Sourcepub fn with_retryable(
kind: BackendErrorKind,
message: impl Into<String>,
retryable: bool,
) -> Self
pub fn with_retryable( kind: BackendErrorKind, message: impl Into<String>, retryable: bool, ) -> Self
Creates a new backend error with explicit retryable flag.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether this error can be retried.
Sourcepub fn rate_limit(message: impl Into<String>) -> Self
pub fn rate_limit(message: impl Into<String>) -> Self
Rate limit or quota exceeded.
Sourcepub fn invalid_request(message: impl Into<String>) -> Self
pub fn invalid_request(message: impl Into<String>) -> Self
Invalid request parameters.
Backend not available.
Sourcepub fn unsupported(capability: &Capability) -> Self
pub fn unsupported(capability: &Capability) -> Self
Capability not supported.
Sourcepub fn resource_exhausted(message: impl Into<String>) -> Self
pub fn resource_exhausted(message: impl Into<String>) -> Self
Resource exhausted (budget, memory, etc.).
Trait Implementations§
Source§impl Clone for BackendError
impl Clone for BackendError
Source§fn clone(&self) -> BackendError
fn clone(&self) -> BackendError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 BackendError
impl Debug for BackendError
Source§impl<'de> Deserialize<'de> for BackendError
impl<'de> Deserialize<'de> for BackendError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for BackendError
impl Display for BackendError
Source§impl Error for BackendError
impl Error for BackendError
1.30.0 · 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()
Source§impl PartialEq for BackendError
impl PartialEq for BackendError
Source§fn eq(&self, other: &BackendError) -> bool
fn eq(&self, other: &BackendError) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for BackendError
impl Serialize for BackendError
impl Eq for BackendError
impl StructuralPartialEq for BackendError
Auto Trait Implementations§
impl Freeze for BackendError
impl RefUnwindSafe for BackendError
impl Send for BackendError
impl Sync for BackendError
impl Unpin for BackendError
impl UnsafeUnpin for BackendError
impl UnwindSafe for BackendError
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.