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>) -> ErrorObject
pub fn from_spec(spec: ErrorSpec, reason: impl Into<String>) -> ErrorObject
Builds an error object from a registry ErrorSpec.
Sourcepub fn new(
code: u16,
class: ErrorClass,
retryable: bool,
fatal: bool,
reason: impl Into<String>,
) -> ErrorObject
pub fn new( code: u16, class: ErrorClass, retryable: bool, fatal: bool, reason: impl Into<String>, ) -> ErrorObject
Builds an error object with arbitrary fields (for codes outside the registry).
Sourcepub fn from_cbor(data: &[u8]) -> Result<ErrorObject, CodecError>
pub fn from_cbor(data: &[u8]) -> Result<ErrorObject, 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<ErrorObject, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ErrorObject, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ErrorObject
impl Serialize for ErrorObject
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more