pub struct ErrorHandling<E> {
pub err: E,
pub reporting: ErrorReporting,
}
Expand description
Specifies how an “internal” error is converted to an “external” public error and any logging or reporting that should happen.
Fields§
§err: E
The external error that should be returned.
reporting: ErrorReporting
How the error should be reported.
Implementations§
source§impl<E> ErrorHandling<E>
impl<E> ErrorHandling<E>
sourcepub fn convert(err: E) -> Self
pub fn convert(err: E) -> Self
Create an ErrorHandling instance with an error conversion.
ErrorHandling instance are created using a builder-style API. This is always the first
function in the chain, optionally followed by log()
, report()
, etc.
sourcepub fn report(self, report_class: impl Into<String>) -> Self
pub fn report(self, report_class: impl Into<String>) -> Self
Add reporting to an ErrorHandling instance
sourcepub fn log_warning(self) -> Self
pub fn log_warning(self) -> Self
log a warning
sourcepub fn report_error(self, report_class: impl Into<String>) -> Self
pub fn report_error(self, report_class: impl Into<String>) -> Self
Add reporting to an ErrorHandling instance and also log an Error
Auto Trait Implementations§
impl<E> Freeze for ErrorHandling<E>where
E: Freeze,
impl<E> RefUnwindSafe for ErrorHandling<E>where
E: RefUnwindSafe,
impl<E> Send for ErrorHandling<E>where
E: Send,
impl<E> Sync for ErrorHandling<E>where
E: Sync,
impl<E> Unpin for ErrorHandling<E>where
E: Unpin,
impl<E> UnwindSafe for ErrorHandling<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
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>
Read more