pub enum Error {
Show 13 variants
MessageTooLarge {
size: usize,
max_size: usize,
},
MessageNotFound(MessageId),
Encode(String),
Decode(String),
Send {
target: String,
reason: String,
},
Shutdown,
NoPeers,
Channel(String),
QueueFull {
dropped: usize,
capacity: usize,
},
Memberlist(String),
Config(String),
Io(Error),
Custom(String),
}Expand description
Errors that can occur during Plumtree operations.
Variants§
MessageTooLarge
Message payload exceeds the configured maximum size.
MessageNotFound(MessageId)
Message was not found in the cache.
Encode(String)
Failed to encode a message.
Decode(String)
Failed to decode a message.
Send
Network send operation failed.
Fields
Shutdown
The Plumtree instance has been shut down.
NoPeers
No peers available for broadcast.
Channel(String)
Internal channel error.
QueueFull
Outgoing message queue is full (backpressure).
This error indicates the system is under load and the caller should back off and retry later.
Fields
Memberlist(String)
Memberlist operation failed.
Config(String)
Configuration error.
Io(Error)
Generic IO error.
Custom(String)
Custom error with message.
Implementations§
Source§impl Error
impl Error
Sourcepub const fn kind(&self) -> ErrorKind
pub const fn kind(&self) -> ErrorKind
Get the classification of this error.
Returns ErrorKind::Transient for errors that may succeed if retried,
or ErrorKind::Permanent for errors that will not succeed with retries.
Sourcepub const fn is_transient(&self) -> bool
pub const fn is_transient(&self) -> bool
Check if this error is transient (may succeed if retried).
§Example
match plumtree.broadcast(payload).await {
Ok(_) => {}
Err(e) if e.is_transient() => {
// Retry after a delay
tokio::time::sleep(Duration::from_millis(100)).await;
plumtree.broadcast(payload).await?;
}
Err(e) => return Err(e), // Permanent error, don't retry
}Sourcepub const fn is_permanent(&self) -> bool
pub const fn is_permanent(&self) -> bool
Check if this error is permanent (will not succeed with retries).
Sourcepub const fn is_shutdown(&self) -> bool
pub const fn is_shutdown(&self) -> bool
Check if this error indicates the system is shutting down.
Sourcepub fn is_resource_exhausted(&self) -> bool
pub fn is_resource_exhausted(&self) -> bool
Check if this is a rate limiting or resource exhaustion error.
Sourcepub const fn is_queue_full(&self) -> bool
pub const fn is_queue_full(&self) -> bool
Check if this is a queue full error (backpressure).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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