pub enum BulkheadServiceError<E> {
Bulkhead(BulkheadError),
Inner(E),
}Expand description
Service-level error that wraps inner service errors.
This error type is returned by the Bulkhead service and
allows services with any error type to be wrapped without requiring
From<BulkheadError> implementations.
§Examples
use tower_resilience_bulkhead::BulkheadServiceError;
// Match on the error to determine the cause
fn handle_error<E: std::fmt::Debug>(err: BulkheadServiceError<E>) {
match err {
BulkheadServiceError::Bulkhead(e) => {
println!("Bulkhead error: {}", e);
}
BulkheadServiceError::Inner(e) => {
println!("Inner service error: {:?}", e);
}
}
}Variants§
Bulkhead(BulkheadError)
Bulkhead-specific error (full or timeout).
Inner(E)
Error from the inner service.
Implementations§
Source§impl<E> BulkheadServiceError<E>
impl<E> BulkheadServiceError<E>
Sourcepub fn is_bulkhead(&self) -> bool
pub fn is_bulkhead(&self) -> bool
Returns true if this is a bulkhead-specific error.
Sourcepub fn into_inner(self) -> Option<E>
pub fn into_inner(self) -> Option<E>
Converts this error into the inner error, if any.
Sourcepub fn bulkhead_error(&self) -> Option<&BulkheadError>
pub fn bulkhead_error(&self) -> Option<&BulkheadError>
Returns a reference to the bulkhead error, if any.
Trait Implementations§
Source§impl<E: Debug> Debug for BulkheadServiceError<E>
impl<E: Debug> Debug for BulkheadServiceError<E>
Source§impl<E: Display> Display for BulkheadServiceError<E>
impl<E: Display> Display for BulkheadServiceError<E>
Source§impl<E: Error + 'static> Error for BulkheadServiceError<E>
impl<E: Error + 'static> Error for BulkheadServiceError<E>
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<E> From<BulkheadError> for BulkheadServiceError<E>
impl<E> From<BulkheadError> for BulkheadServiceError<E>
Source§fn from(err: BulkheadError) -> Self
fn from(err: BulkheadError) -> Self
Converts to this type from the input type.
Source§impl<E> From<BulkheadServiceError<E>> for ResilienceError<E>
impl<E> From<BulkheadServiceError<E>> for ResilienceError<E>
Source§fn from(err: BulkheadServiceError<E>) -> Self
fn from(err: BulkheadServiceError<E>) -> Self
Converts to this type from the input type.
Source§impl<E> From<BulkheadServiceError<ResilienceError<E>>> for ResilienceError<E>
impl<E> From<BulkheadServiceError<ResilienceError<E>>> for ResilienceError<E>
Source§fn from(err: BulkheadServiceError<ResilienceError<E>>) -> Self
fn from(err: BulkheadServiceError<ResilienceError<E>>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<E> Freeze for BulkheadServiceError<E>where
E: Freeze,
impl<E> RefUnwindSafe for BulkheadServiceError<E>where
E: RefUnwindSafe,
impl<E> Send for BulkheadServiceError<E>where
E: Send,
impl<E> Sync for BulkheadServiceError<E>where
E: Sync,
impl<E> Unpin for BulkheadServiceError<E>where
E: Unpin,
impl<E> UnsafeUnpin for BulkheadServiceError<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for BulkheadServiceError<E>where
E: 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
Source§impl<T, E> IntoResilienceError<E> for Twhere
T: Into<ResilienceError<E>>,
impl<T, E> IntoResilienceError<E> for Twhere
T: Into<ResilienceError<E>>,
Source§fn into_resilience_error(self) -> ResilienceError<E>
fn into_resilience_error(self) -> ResilienceError<E>
Convert this error into a
ResilienceError<E>.