#[non_exhaustive]pub struct PairingCodeError {
pub rejection: Option<PairCodeRejection>,
pub backoff: Option<Duration>,
pub error: String,
}Expand description
A phone-number pair-code flow failed, so no linking will come of it.
The counterpart to PairingCode on the failure path, and the only surface
that reports it when pairing is driven by BotBuilder::with_pair_code —
that request runs in a detached task, so nothing returns its error to the
caller. Client::pair_with_code dispatches this in addition to returning
Err, matching how the success path both returns the code and emits
PairingCode.
Both of the flow’s server round trips report here, and the consumer’s move
is the same either way — this code is finished, request another or fall back
to the QR. The later one arrives after a code was already displayed and
entered: the phone answered, but the server refused the key bundle that
answer produced. Silence at that stage is not this event, because nothing
was refused; it surfaces as PairingCodeRefresh once the timer runs out.
Fires for every failure, including local validation (a phone number that is
too short never reaches the server): a consumer waiting on a code needs to
learn that it is not coming, whatever the reason. rejection
is what distinguishes the two — None means the request never got an answer
from the server.
A claim the failed request itself took is released before this fires, so
nothing is left holding the flow and pair_with_code can be called again.
Two failures do not arrive here, because for them a code may still be on its way and this event would say the opposite — a consumer acting on it would tear down a code that is about to arrive:
CodeAlreadyOutstanding— refused precisely because an earlier code is still live, and the consumer already has it from thePairingCodethat minted it. Retrying is futile untilcancel_pair_coderuns or the window closes.Cancelled— the caller withdrew this request, and a replacement may already own the slot. A superseded request can return this after its replacement started, so the event would be uncorrelated with the flow that is actually running.
Both follow from something the caller did, so neither is news, and a direct
caller still gets the Err.
Whether to retry at all is the point of the fields: back off on
PairCodeRejection::is_throttled,
stop on
PairCodeRejection::FeatureNotAvailable.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.rejection: Option<PairCodeRejection>The server’s refusal, when it answered with one. None when the failure
was local (validation, no connection) or the request went unanswered
(timeout) — nothing was refused, so there is no status to report.
backoff: Option<Duration>How long the server asked the client to wait, from the backoff
attribute. Usually absent — WA Web does not read it on this path — but
when present it is the server naming its own retry delay, which beats
any interval the consumer would pick.
error: StringThe failure rendered for logs. Do not branch on it; use
rejection.
Implementations§
Source§impl PairingCodeError
impl PairingCodeError
Sourcepub fn builder() -> PairingCodeErrorBuilder
pub fn builder() -> PairingCodeErrorBuilder
Create an instance of PairingCodeError using the builder syntax
Trait Implementations§
Source§impl Clone for PairingCodeError
impl Clone for PairingCodeError
Source§fn clone(&self) -> PairingCodeError
fn clone(&self) -> PairingCodeError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PairingCodeError
impl Debug for PairingCodeError
Source§impl Serialize for PairingCodeError
impl Serialize for PairingCodeError
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,
Auto Trait Implementations§
impl Freeze for PairingCodeError
impl RefUnwindSafe for PairingCodeError
impl Send for PairingCodeError
impl Sync for PairingCodeError
impl Unpin for PairingCodeError
impl UnsafeUnpin for PairingCodeError
impl UnwindSafe for PairingCodeError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<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 more