#[non_exhaustive]pub enum Cause {
Unreachable,
RateLimited,
ServerError,
AnswerNotUnderstood,
LoginRefused,
TokenExpired,
}Expand description
Why a request to Anthropic did not produce an answer pitboard could use.
The code on an error says what pitboard was doing; this says what went wrong underneath it, and whether trying again is worth anything. Without it every failure that was not a 401 arrived at a front end as one code with a sentence of prose, so neither the command line nor the app could tell being offline from being rate limited from a login Anthropic has finished with.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Unreachable
Anthropic could not be reached at all.
RateLimited
Anthropic asked for less traffic.
ServerError
Anthropic answered, badly, and may answer well later.
AnswerNotUnderstood
Anthropic answered something pitboard does not understand, which means its shape moved. Trying again will produce the same thing.
LoginRefused
This login is finished: revoked, or already used somewhere else.
TokenExpired
The token has expired. For the signed-in login that is ordinary and Claude Code renews it; for a parked one it means the park needs renewing first.
Implementations§
Source§impl Cause
impl Cause
pub fn of(error: &ApiError) -> Cause
Sourcepub fn of_provider(error: &ProviderError) -> Cause
pub fn of_provider(error: &ProviderError) -> Cause
The same question asked of a provider rather than of Anthropic directly.
Sourcepub fn code(self) -> &'static str
pub fn code(self) -> &'static str
Stable, for a program to branch on; the same as its JSON form.
Sourcepub fn worth_retrying(self) -> bool
pub fn worth_retrying(self) -> bool
Whether the same request, later, could answer differently. A front end deciding whether to back off or to give up reads this and nothing else.
Trait Implementations§
impl Copy for Cause
impl Eq for Cause
impl StructuralPartialEq for Cause
Auto Trait Implementations§
impl Freeze for Cause
impl RefUnwindSafe for Cause
impl Send for Cause
impl Sync for Cause
impl Unpin for Cause
impl UnsafeUnpin for Cause
impl UnwindSafe for Cause
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.