#[non_exhaustive]pub enum Error {
Transport(String),
TokenRefresh(TokenCacheError),
InvalidPathPrefix {
prefix: String,
reason: String,
},
Rejected {
code: Code,
message: String,
},
RateLimited {
message: String,
retry_after: Option<Duration>,
},
ServerError {
code: Code,
message: String,
},
ProtoMismatch(String),
}Expand description
All errors returned by the Ppoppo gRPC client SDKs.
Error::Rejected— the call reached the server and was turned down at the application layer (don’t retry as-is).Error::ServerError— a 5xx-class state (retry-eligible).Error::Transport— the call never reached the server.Error::RateLimited— the substrate-authoritative rate-limit denial (ResourceExhausted), carrying aretry_afterhint for precise retry scheduling.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Transport(String)
Connection, TLS, or network-level failure.
TokenRefresh(TokenCacheError)
Bearer token acquisition failed before the gRPC call could be made.
InvalidPathPrefix
The configured path prefix is malformed — caught at connect time.
Rejected
The server returned a non-OK gRPC status at the application layer
(InvalidArgument, NotFound, PermissionDenied, Unauthenticated,
FailedPrecondition, AlreadyExists, OutOfRange, Aborted,
Cancelled).
Caller’s input, auth, or state is bad — do not retry as-is.
ResourceExhausted is not routed here; it surfaces as
Error::RateLimited which carries the retry_after hint.
RateLimited
The rate-limit substrate denied the call (ResourceExhausted).
retry_after carries the substrate-authoritative reset duration when
the server attached retry-after metadata; None means the substrate
failed to surface a hint and callers should fall back to a default
backoff. Consumers SHOULD wait at least retry_after before retrying —
retrying earlier just trips the same bucket again (the reset instant has
not passed), burning attempts without making progress.
ServerError
The server returned a 5xx-class status (Internal, Unknown,
DataLoss, Unimplemented, DeadlineExceeded). Retry-eligible.
ProtoMismatch(String)
A required proto field was absent or could not be mapped to a domain type.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether retrying the same call as-is may succeed.
Mirrors the house is_retryable idiom (cf.
ppoppo_error::PortErrorKind::is_retryable): transient transport loss,
5xx-class server errors, and rate-limit denials are retryable — the
last only after honoring the retry_after hint (retrying earlier trips
the same bucket). Application-layer rejections, a dead credential, a
malformed prefix, and proto-shape mismatches are terminal: retrying
reproduces the same failure.
Note ServerError carries tonic::Code::Unimplemented (see
classify_status) into the retryable set: a rolling deploy can
transiently return it before the method is wired on every replica.
A permanently unimplemented method still fails after the retry
budget; a mid-deploy one recovers — this is an intentional bias for
the GKE rolling-update window, not an oversight.
The match is exhaustive (no wildcard): a future #[non_exhaustive]
variant forces a compile error here rather than silently defaulting to
“not retryable”, keeping the family retry taxonomy drift-proof.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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<TokenCacheError> for Error
impl From<TokenCacheError> for Error
Source§fn from(source: TokenCacheError) -> Error
fn from(source: TokenCacheError) -> Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request