Struct ockam_core::errcode::ErrorCode
source · #[non_exhaustive]pub struct ErrorCode {
pub origin: Origin,
pub kind: Kind,
pub extra: i32,
}Expand description
A set of abstract error codes describing an error. See the module-level documentation for details.
The fields of this struct are pub for matching, but you need to go through
one of the constructor functions to create one of these
(and not a literal), as it is a #[non_exhaustive] type (which may change in
the future, since it’s unclear if this provides value).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.origin: OriginThe Origin of this error.
kind: KindThe Kind of this error.
extra: i32An additional identifying numeric payload, or 0 if none is relevant.
For example, it would be reasonable for this field to hold:
- HTTP status code
- OS
errno/GetLastErrorcode - The exit status returned by a subprocess
- A numeric error code from some other system
- Et cetera.
But should generally not be used to hold non-identifying metadata, such as the date, device IDs, as that information should be stored on the payload itself.
Concretely: two ErrorCode with different extra values should
identify types of errors.
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for ErrorCode
impl<'de> Deserialize<'de> for ErrorCode
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Ord for ErrorCode
impl Ord for ErrorCode
source§impl PartialOrd for ErrorCode
impl PartialOrd for ErrorCode
impl Copy for ErrorCode
impl Eq for ErrorCode
impl StructuralPartialEq for ErrorCode
Auto Trait Implementations§
impl Freeze for ErrorCode
impl RefUnwindSafe for ErrorCode
impl Send for ErrorCode
impl Sync for ErrorCode
impl Unpin for ErrorCode
impl UnwindSafe for ErrorCode
Blanket Implementations§
source§impl<D> AsyncTryClone for D
impl<D> AsyncTryClone for D
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)