pub enum UsageError {
UnsupportedProvider {
provider: String,
},
AccountIdUnavailable,
IdentityMismatch,
InvalidEndpointOverride,
Unauthorized {
status: u16,
},
RateLimited {
retry_after_s: Option<u64>,
},
UpstreamStatus {
status: u16,
retry_after_s: Option<u64>,
},
Redirected {
status: u16,
},
Timeout,
Transport {
detail: String,
},
BodyTooLarge {
cap: usize,
},
Malformed {
detail: String,
},
}Expand description
Usage failures. Display/Serialize never include a token, a URL query,
or any upstream body bytes.
Variants§
UnsupportedProvider
No adapter for this provider.
Codex: the access token carries no chatgpt_account_id claim, so the
account header cannot be paired with the bearer. Fail closed.
IdentityMismatch
Codex: the response names a different account than the token. The pairing invariant is violated; the snapshot is discarded.
InvalidEndpointOverride
A non-pinned, non-loopback endpoint override was supplied.
Provider rejected the credential (401/403).
Fields
RateLimited
429 on the usage endpoint itself. Not proof of quota exhaustion.
retry_after_s is the delta-seconds Retry-After header, if sent.
UpstreamStatus
Any other non-2xx status. retry_after_s: the delta-seconds
Retry-After header, if sent (an HTTP-date is ignored).
Redirected
3xx. Redirects are never followed.
Timeout
No answer within the timeout: no status, no Retry-After.
Transport
Transport failure; detail is a coarse class, never a URL or body.
BodyTooLarge
Malformed
Body could not be parsed; detail names the shape, never values.
Implementations§
Source§impl UsageError
impl UsageError
Sourcepub fn is_auth_failure(&self) -> bool
pub fn is_auth_failure(&self) -> bool
True when the failure means the credential itself was rejected.
Sourcepub fn failure(&self) -> ObservationFailure
pub fn failure(&self) -> ObservationFailure
The typed observation failure this error stands for (kind, HTTP
status, Retry-After), for selection reports and logs.
Sourcepub fn into_broker_error(self) -> BrokerError
pub fn into_broker_error(self) -> BrokerError
Map onto the broker error vocabulary (secret-free by construction).
Trait Implementations§
Source§impl Clone for UsageError
impl Clone for UsageError
Source§fn clone(&self) -> UsageError
fn clone(&self) -> UsageError
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 UsageError
impl Debug for UsageError
Source§impl<'de> Deserialize<'de> for UsageError
impl<'de> Deserialize<'de> for UsageError
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<UsageError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<UsageError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for UsageError
impl Display for UsageError
impl Eq for UsageError
Source§impl Error for UsageError
impl Error for UsageError
1.30.0 · 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<&UsageError> for UsageErrorSummary
impl From<&UsageError> for UsageErrorSummary
Source§fn from(e: &UsageError) -> UsageErrorSummary
fn from(e: &UsageError) -> UsageErrorSummary
Source§impl PartialEq for UsageError
impl PartialEq for UsageError
Source§impl Serialize for UsageError
impl Serialize for UsageError
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,
impl StructuralPartialEq for UsageError
Auto Trait Implementations§
impl Freeze for UsageError
impl RefUnwindSafe for UsageError
impl Send for UsageError
impl Sync for UsageError
impl Unpin for UsageError
impl UnsafeUnpin for UsageError
impl UnwindSafe for UsageError
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> DowncastSync for T
impl<T> DowncastSync for T
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> ThreadSafetyMarker for Twhere
T: Send,
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