pub struct ServiceError {
pub code: String,
pub message: String,
pub retryable: bool,
pub details: Option<Value>,
}Expand description
Typed wire error. retryable means resubmitting the request can succeed.
Equality compares code, message, retryable and details.
Fields§
§code: String§message: String§retryable: bool§details: Option<Value>Optional structured data (e.g. the platform of a needs_auth). Absent
or null on the wire reads as None; written only when present, so
older peers see the frame they always saw. Set with
ServiceError::with_details, read with ServiceError::details.
Implementations§
Source§impl ServiceError
impl ServiceError
pub fn new(code: impl Into<String>, message: impl Into<String>) -> Self
pub fn retryable(code: impl Into<String>, message: impl Into<String>) -> Self
Sourcepub fn with_details(self, details: Value) -> Self
pub fn with_details(self, details: Value) -> Self
Attaches structured details; Value::Null clears them.
Sourcepub fn details(&self) -> Option<&Value>
pub fn details(&self) -> Option<&Value>
Structured data attached with ServiceError::with_details, or None.
pub fn handoff() -> Self
pub fn to_value(&self) -> Value
pub fn from_value(v: &Value) -> Self
Trait Implementations§
Source§impl Clone for ServiceError
impl Clone for ServiceError
Source§impl Debug for ServiceError
impl Debug for ServiceError
Source§impl Display for ServiceError
impl Display for ServiceError
impl Eq for ServiceError
Source§impl Error for ServiceError
impl Error for ServiceError
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()
Source§impl From<Error> for ServiceError
impl From<Error> for ServiceError
Source§impl From<HostIdentityError> for ServiceError
impl From<HostIdentityError> for ServiceError
Source§fn from(e: HostIdentityError) -> Self
fn from(e: HostIdentityError) -> Self
The wire-style form of a host identity refusal: code ERROR_HOST_IDENTITY, not retryable.
Source§impl From<ServiceError> for ConnectError
impl From<ServiceError> for ConnectError
Source§fn from(e: ServiceError) -> Self
fn from(e: ServiceError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ServiceError
impl PartialEq for ServiceError
impl StructuralPartialEq for ServiceError
Auto Trait Implementations§
impl Freeze for ServiceError
impl RefUnwindSafe for ServiceError
impl Send for ServiceError
impl Sync for ServiceError
impl Unpin for ServiceError
impl UnsafeUnpin for ServiceError
impl UnwindSafe for ServiceError
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