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.
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
impl Code
Sourcepub const fn as_str(self) -> &'static str
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.
Sourcepub const fn is_retryable(self) -> bool
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).