pub struct ErrorObject {
pub code: u16,
pub class: u8,
pub retryable: bool,
pub fatal: bool,
pub reason: String,
pub details_cbor: ByteBuf,
}Expand description
Wire-serialisable error object.
details_cbor carries opaque, structured details. Implementations MUST NOT
place secret material or sensitive payload bytes into reason or
details_cbor — error objects are forwarded across trust boundaries.
Fields§
§code: u16Numeric error code (see gbp_core::errors::codes).
class: u8Error class as a u8 (see gbp_core::ErrorClass).
retryable: boolWhether the operation MAY be retried.
fatal: boolWhether the error is fatal (the node moves to FAILED).
reason: StringHuman-readable reason. MUST NOT carry secrets.
details_cbor: ByteBufStructured detail bytes (typically CBOR).
Implementations§
Source§impl ErrorObject
impl ErrorObject
Sourcepub fn from_spec(spec: ErrorSpec, reason: impl Into<String>) -> Self
pub fn from_spec(spec: ErrorSpec, reason: impl Into<String>) -> Self
Builds an error object from a registry ErrorSpec.
Sourcepub fn new(
code: u16,
class: ErrorClass,
retryable: bool,
fatal: bool,
reason: impl Into<String>,
) -> Self
pub fn new( code: u16, class: ErrorClass, retryable: bool, fatal: bool, reason: impl Into<String>, ) -> Self
Builds an error object with arbitrary fields (for codes outside the registry).
Sourcepub fn from_cbor(data: &[u8]) -> Result<Self, CodecError>
pub fn from_cbor(data: &[u8]) -> Result<Self, CodecError>
Decodes a CBOR-encoded error object.
Trait Implementations§
Source§impl Clone for ErrorObject
impl Clone for ErrorObject
Source§fn clone(&self) -> ErrorObject
fn clone(&self) -> ErrorObject
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ErrorObject
impl Debug for ErrorObject
Source§impl<'de> Deserialize<'de> for ErrorObject
impl<'de> Deserialize<'de> for ErrorObject
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ErrorObject
impl RefUnwindSafe for ErrorObject
impl Send for ErrorObject
impl Sync for ErrorObject
impl Unpin for ErrorObject
impl UnsafeUnpin for ErrorObject
impl UnwindSafe for ErrorObject
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