pub struct YtError {
pub code: i32,
pub message: String,
pub attributes: Vec<(String, Vec<u8>)>,
pub inner_errors: Vec<YtError>,
}Expand description
An error reported by the server, with its nesting preserved.
Fields§
§code: i32§message: String§attributes: Vec<(String, Vec<u8>)>Attribute values are YSON, exactly as the wire carries them; they are kept as bytes so nothing is lost to a decoder this crate does not need.
inner_errors: Vec<YtError>Implementations§
Source§impl YtError
impl YtError
Sourcepub fn from_proto(proto: &TError) -> Self
pub fn from_proto(proto: &TError) -> Self
Reads the protobuf form, keeping the whole tree.
Sourcepub fn find(&self, code: i32) -> Option<&YtError>
pub fn find(&self, code: i32) -> Option<&YtError>
The first error in the tree with this code, outermost first.
The useful question is almost never “what is the outer code” but “is
this failure a NoSuchTransaction anywhere inside”, because retry and
reporting decisions hang on the inner code.
Sourcepub fn has_code(&self, code: i32) -> bool
pub fn has_code(&self, code: i32) -> bool
Whether this error or any error nested inside it has this code.
Trait Implementations§
impl Eq for YtError
Source§impl Error for YtError
impl Error for YtError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
impl StructuralPartialEq for YtError
Auto Trait Implementations§
impl Freeze for YtError
impl RefUnwindSafe for YtError
impl Send for YtError
impl Sync for YtError
impl Unpin for YtError
impl UnsafeUnpin for YtError
impl UnwindSafe for YtError
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