#[non_exhaustive]pub enum Error {
Api(Box<ApiError>),
Transport {
outcome_unknown: bool,
source: Error,
},
Decode {
status: u16,
source: Error,
},
InvalidRequest(String),
Stream(String),
}Expand description
Everything a request can end in other than success.
Match on the variant and on ApiError::code, never on message text. The enum is
#[non_exhaustive], so keep a catch-all arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Api(Box<ApiError>)
The server answered and refused the request.
Transport
The request did not complete: connection refused, reset, timed out, or the response could not be read.
For a write, Error::is_outcome_unknown says whether the server may still have applied it.
A transaction with an identity is safe to resubmit with the same id: the authority
recognizes the retry as a duplicate instead of applying it twice.
Decode
The server answered successfully with a body this client could not decode.
InvalidRequest(String)
Refused before anything was sent: the request is not one the server could accept.
Stream(String)
An event stream ended with a reported authority error.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_outcome_unknown(&self) -> bool
pub fn is_outcome_unknown(&self) -> bool
True when a write may or may not have been applied: it was sent, and no answer arrived. Reconcile by resubmitting a transaction with the same id, or by reading the state back.
Sourcepub fn precondition_failure(&self) -> Option<&PreconditionFailure>
pub fn precondition_failure(&self) -> Option<&PreconditionFailure>
The structured precondition failure of a refused transaction.
Sourcepub fn is_conflict(&self) -> bool
pub fn is_conflict(&self) -> bool
True for a refusal caused by state: a failed precondition or fence, a version, epoch or lease conflict, a record already present. Retry against fresh state, not unchanged.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()