#[non_exhaustive]pub enum EventBusError {
Internal(String),
Validation(String),
Serialization(String),
InvalidTransition {
from: String,
to: String,
},
Connection(String),
Timeout(String),
Source {
context: String,
source: Box<dyn Error + Send + Sync + 'static>,
},
}Expand description
Errors returned by the event bus.
The enum is marked #[non_exhaustive] so new variants can be added in a
non-breaking way; external crates must include a _ => ... arm when
matching exhaustively.
Prefer EventBusError::source when wrapping an underlying error from a
backend or codec — it preserves the causal chain via std::error::Error::source,
allowing tracing/observability stacks to render the full chain without
losing typed information to stringification.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Internal(String)
Validation(String)
Serialization(String)
InvalidTransition
Connection(String)
Timeout(String)
Source
An underlying error from a backend, codec, or dependency, with its
source chain preserved. Construct via EventBusError::source.
Implementations§
Source§impl EventBusError
impl EventBusError
Sourcepub fn source<E>(context: impl Into<String>, err: E) -> Self
pub fn source<E>(context: impl Into<String>, err: E) -> Self
Wrap an underlying error with a human-readable context string while
preserving the source chain for error.source() traversal.
§Example
use eventbus_core::EventBusError;
fn parse_int(s: &str) -> Result<u32, EventBusError> {
s.parse::<u32>()
.map_err(|e| EventBusError::source("parsing retry attempt", e))
}Trait Implementations§
Source§impl Debug for EventBusError
impl Debug for EventBusError
Source§impl Display for EventBusError
impl Display for EventBusError
Source§impl Error for EventBusError
impl Error for EventBusError
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 !RefUnwindSafe for EventBusError
impl !UnwindSafe for EventBusError
impl Freeze for EventBusError
impl Send for EventBusError
impl Sync for EventBusError
impl Unpin for EventBusError
impl UnsafeUnpin for EventBusError
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