#[non_exhaustive]pub enum NatsError {
Connect(Box<dyn StdError + Send + Sync>),
Publish(Box<dyn StdError + Send + Sync>),
Subscribe(Box<dyn StdError + Send + Sync>),
JetStream(Box<dyn StdError + Send + Sync>),
Shutdown(Box<dyn StdError + Send + Sync>),
RequestTimeout,
Closed {
subject: String,
},
InvalidOptions(String),
}Expand description
Errors surfaced by the NATS broker implementation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Connect(Box<dyn StdError + Send + Sync>)
Failed to establish or use the underlying async-nats connection.
Publish(Box<dyn StdError + Send + Sync>)
Failed to publish a message to the broker.
Subscribe(Box<dyn StdError + Send + Sync>)
Failed to subscribe to the requested subject.
JetStream(Box<dyn StdError + Send + Sync>)
JetStream-specific operation failed (consumer creation, publish acknowledgement, ack).
Shutdown(Box<dyn StdError + Send + Sync>)
Draining the connection during
shutdown failed.
RequestTimeout
A request / reply operation timed out before a reply was received.
Closed
A publisher aliasing the connection was used after the broker shut down.
The lifecycle ladder makes misuse through the owner’s handle a compile error:
ConnectedBroker::shutdown consumes the connected
broker. Publishers paired off it earlier keep aliasing the closed connection, so their
operations report this instead of silently succeeding against a dead connection.
InvalidOptions(String)
The subscription descriptor names an empty subject. Combinations of settings the broker cannot honour are rejected by the types instead, so this is what is left: a subject is a string the caller supplies, often from configuration.
Trait Implementations§
Source§impl Error for NatsError
impl Error for NatsError
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
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for NatsError
impl !UnwindSafe for NatsError
impl Freeze for NatsError
impl Send for NatsError
impl Sync for NatsError
impl Unpin for NatsError
impl UnsafeUnpin for NatsError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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