#[non_exhaustive]pub enum InboxProcessError<S, H> {
Store(S),
Handler(H),
}Expand description
Whose fault it was. Split so the caller can tell “my handler failed” (record it, nak) from
“the inbox could not be read or written” (record nothing, nak).
use reliar_inbox::InboxProcessError;
#[derive(Debug)]
struct StoreError;
impl std::fmt::Display for StoreError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("store unavailable")
}
}
impl std::error::Error for StoreError {}
let err: InboxProcessError<StoreError, std::convert::Infallible> =
InboxProcessError::Store(StoreError);
assert_eq!(err.to_string(), "inbox store failed: store unavailable");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.
Trait Implementations§
Source§impl<S, H> Classify for InboxProcessError<S, H>where
S: Classify,
Maps Self::Store to the store error’s own FailureKind and Self::Handler to
FailureKind::Transient — a handler failure is retried by the broker’s redelivery, and
the inbox has no authority to call a message permanently dead (ADR 0042 §4).
impl<S, H> Classify for InboxProcessError<S, H>where
S: Classify,
Maps Self::Store to the store error’s own FailureKind and Self::Handler to
FailureKind::Transient — a handler failure is retried by the broker’s redelivery, and
the inbox has no authority to call a message permanently dead (ADR 0042 §4).
use reliar_core::{Classify, FailureKind};
use reliar_inbox::InboxProcessError;
#[derive(Debug)]
struct StoreError;
impl Classify for StoreError {
fn kind(&self) -> FailureKind {
FailureKind::Permanent
}
}
#[derive(Debug)]
struct HandlerError;
// A handler failure is always `Transient`, regardless of the store error's own kind.
let err: InboxProcessError<StoreError, HandlerError> = InboxProcessError::Handler(HandlerError);
assert_eq!(err.kind(), FailureKind::Transient);Source§fn kind(&self) -> FailureKind
fn kind(&self) -> FailureKind
Whether the failure this error represents can succeed on retry. Read more
Source§impl<S, H> Display for InboxProcessError<S, H>
impl<S, H> Display for InboxProcessError<S, H>
Source§impl<S, H> Error for InboxProcessError<S, H>
impl<S, H> Error for InboxProcessError<S, H>
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<S, H> Freeze for InboxProcessError<S, H>
impl<S, H> RefUnwindSafe for InboxProcessError<S, H>where
S: RefUnwindSafe,
H: RefUnwindSafe,
impl<S, H> Send for InboxProcessError<S, H>
impl<S, H> Sync for InboxProcessError<S, H>
impl<S, H> Unpin for InboxProcessError<S, H>
impl<S, H> UnsafeUnpin for InboxProcessError<S, H>where
S: UnsafeUnpin,
H: UnsafeUnpin,
impl<S, H> UnwindSafe for InboxProcessError<S, H>where
S: UnwindSafe,
H: UnwindSafe,
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