#[non_exhaustive]pub enum PairError {
PairCode(PairCodeError),
RequestFailed(IqError),
}Expand description
Errors raised by the high-level pair-code flow.
Wraps wacore::pair_code::PairCodeError (validation, key derivation, bundle
building) and adds the IQ transport layer via RequestFailed.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PairCode(PairCodeError)
RequestFailed(IqError)
The pair-code IQ was rejected by the server.
Note the server returns bad-request (400) both for genuinely invalid
content and for rate-limiting — it throttles pair-code requests per
phone number and reuses the same error. So a 400 here is not necessarily a
permanent/invalid-input failure: back off and retry rather than treating
every 400 as fatal. (The lib canonicalizes the companion_platform_display
OS, so a display-shaped rejection is already ruled out — see
wacore::companion_reg::CompanionOs.) Any server backoff hint is
preserved on the wrapped IqError.
Renders what it wraps, per the rendering
convention — so the code and text reach a log
line that only prints the error, without the reader having to reach for
the Debug form.
Implementations§
Source§impl PairError
impl PairError
Sourcepub fn rejection(&self) -> Option<PairCodeRejection>
pub fn rejection(&self) -> Option<PairCodeRejection>
How the server refused the request, as a status to branch on.
None when nothing was refused: local validation, no connection, or a
request that went unanswered. Prefer this to matching the message, which
is not a stable surface.
Classified from the code and text together, so a pairing WA Web
would not accept yields None rather than the named arm — see
PairCodeRejection::from_server. The refused-but-unclassifiable case
is therefore indistinguishable here from “nothing was refused”; both
mean the same thing to a consumer, which is that there is no typed
status to act on and the message is all there is.
Sourcepub fn lost_the_flow_to_another_request(&self) -> bool
pub fn lost_the_flow_to_another_request(&self) -> bool
Whether this request lost the pairing flow to someone else rather than ending it — so its failure says nothing about whether a code arrives.
These are the failures Event::PairingCodeError must stay silent for,
because its meaning is “no code is coming” and here that is not what
happened:
PairCodeError::CodeAlreadyOutstanding— refused because an earlier code is still inside its validity window. That code is on screen and may yet be entered; the consumer already has it from theEvent::PairingCodethat minted it.PairCodeError::Cancelled— the caller withdrew this request viaClient::cancel_pair_code, and a replacement may already own the slot. Reporting the predecessor would let a consumer read the live replacement as failed and tear down a code that is about to arrive.
Both are consequences of something the caller did, so neither is news to
them, and a direct caller still receives the Err either way.
Sourcepub fn backoff(&self) -> Option<Duration>
pub fn backoff(&self) -> Option<Duration>
How long the server asked the client to wait before retrying, from the
backoff attribute.
Usually None — the server rarely populates it on this request, and WA
Web never reads it — but a value here is the server naming its own delay,
which beats an interval the consumer picked.
Trait Implementations§
Source§impl Error for PairError
impl Error for PairError
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()
Source§impl From<PairCodeError> for PairError
impl From<PairCodeError> for PairError
Source§fn from(source: PairCodeError) -> Self
fn from(source: PairCodeError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for PairError
impl !UnwindSafe for PairError
impl Freeze for PairError
impl Send for PairError
impl Sync for PairError
impl Unpin for PairError
impl UnsafeUnpin for PairError
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<E> ErrorChainExt for Ewhere
E: Error + 'static,
impl<E> ErrorChainExt for Ewhere
E: Error + 'static,
fn as_dyn_error(&self) -> &(dyn Error + 'static)
Source§fn sources(&self) -> Sources<'_> ⓘ
fn sources(&self) -> Sources<'_> ⓘ
Source§fn server_rejection(&self) -> Option<ServerRejection<'_>>
fn server_rejection(&self) -> Option<ServerRejection<'_>>
Source§fn is_timeout(&self) -> bool
fn is_timeout(&self) -> bool
Source§fn store_failure(&self) -> Option<&StoreError>
fn store_failure(&self) -> Option<&StoreError>
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read moreimpl<T> MaybeSend for T
impl<T> MaybeSendSync for T
impl<T> Spawnable for Twhere
T: Send + 'static,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more