pub struct ErrorHandlingLayer { /* private fields */ }
Expand description
A Tower layer for handling and converting service errors into a custom Error
type.
This layer wraps a service and intercepts any errors returned by the service.
It attempts to downcast the error into the custom Error
enum. If the downcast
succeeds, it returns the downcasted Error
. If the downcast fails, the original
error is wrapped in Error::Failed
.
The service’s error type must implement Into<BoxDynError>
, allowing for flexible
error handling, especially when dealing with trait objects or complex error chains.
Implementations§
Trait Implementations§
Source§impl Clone for ErrorHandlingLayer
impl Clone for ErrorHandlingLayer
Source§fn clone(&self) -> ErrorHandlingLayer
fn clone(&self) -> ErrorHandlingLayer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ErrorHandlingLayer
impl Debug for ErrorHandlingLayer
Source§impl Default for ErrorHandlingLayer
impl Default for ErrorHandlingLayer
Auto Trait Implementations§
impl Freeze for ErrorHandlingLayer
impl RefUnwindSafe for ErrorHandlingLayer
impl Send for ErrorHandlingLayer
impl Sync for ErrorHandlingLayer
impl Unpin for ErrorHandlingLayer
impl UnwindSafe for ErrorHandlingLayer
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