Skip to main content

Code

Enum Code 

Source
pub enum Code {
Show 16 variants Canceled, Unknown, InvalidArgument, DeadlineExceeded, NotFound, AlreadyExists, PermissionDenied, ResourceExhausted, FailedPrecondition, Aborted, OutOfRange, Unimplemented, Internal, Unavailable, DataLoss, Unauthenticated,
}
Expand description

Error category: the 16 Connect codes, one-to-one.

A missed NotAfter commit deadline, a full shard, outbox backpressure and pending verification are Code::Unavailable, never Code::ResourceExhausted (SPEC-TRANSPORT-CONNECT §5): nothing commits and a retry with the same nonce is safe. Admission challenges and denials are Code::PermissionDenied, never ResourceExhausted, because clients retry that code on a backoff ladder.

Variants§

§

Canceled

The caller canceled the request.

§

Unknown

No more specific category applies.

§

InvalidArgument

Malformed request: bad ref name, noncanonical field, wrong framing.

§

DeadlineExceeded

The request ran past its deadline.

§

NotFound

The named ref, pack or repository does not exist (or is private).

§

AlreadyExists

The entity the caller tried to create already exists.

§

PermissionDenied

Authenticated, but not allowed; also every admission challenge (HTTP 402) and denial.

§

ResourceExhausted

A client-attributable size or rate cap, such as an oversized pack or a spent per-signer quota. Never a server-side capacity limit: those are Code::Unavailable.

§

FailedPrecondition

A compare-and-swap precondition or upload ticket did not hold.

§

Aborted

The same operation is in flight; the client may retry unchanged.

§

OutOfRange

A value outside its valid range.

§

Unimplemented

The deployment does not support this procedure.

§

Internal

A server-side failure.

§

Unavailable

Temporarily unable to commit: backend outage, missed NotAfter deadline, full shard, outbox backpressure or pending verification. Retrying with the same nonce is safe.

§

DataLoss

Unrecoverable data loss or corruption.

§

Unauthenticated

Missing or invalid credentials.

Implementations§

Source§

impl Code

Source

pub const fn as_str(self) -> &'static str

The Connect protocol’s canonical name, e.g. invalid_argument. Also the code label value for crate::METRIC_REQUESTS.

Source

pub const fn is_retryable(self) -> bool

Whether a client retries this code on its backoff ladder: unavailable, resource_exhausted and aborted (SPEC-TRANSPORT §7, SPEC-TRANSPORT-CONNECT §5).

Trait Implementations§

Source§

impl Clone for Code

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Code

Source§

impl Debug for Code

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Code

Source§

impl Hash for Code

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Code

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Code

Auto Trait Implementations§

§

impl Freeze for Code

§

impl RefUnwindSafe for Code

§

impl Send for Code

§

impl Sync for Code

§

impl Unpin for Code

§

impl UnsafeUnpin for Code

§

impl UnwindSafe for Code

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSync for T
where T: Sync + ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more