#[non_exhaustive]pub enum ClientError {
Transport(Error),
Http {
status: u16,
body: String,
request_id: Option<String>,
},
Auth(String),
Decode(Error),
MalformedEvent(String),
HistoryGap {
reason: GapReason,
},
StreamProtocol {
message: String,
request_id: Option<String>,
},
Config(String),
StateStore(StoreError),
TriggerFailed {
kind: TriggerKindLabel,
source: TriggerError,
},
}Expand description
Errors returned by aviso client operations.
Variants are added as new features land. The enum is marked
#[non_exhaustive] so downstream match arms must include a wildcard.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Transport(Error)
Network-level failure: connect, TLS, DNS, or partial body read.
Http
Server responded with a non-success HTTP status. Carries the verbatim
response body and the server’s X-Request-ID header (if present).
Fields
Auth(String)
Authentication setup, token refresh, or auth source resolution failed.
Decode(Error)
Failed to decode a response body as JSON.
MalformedEvent(String)
CloudEvent envelope contained a malformed event id. Terminal per D9 to avoid reconnect
livelock on a poisoned server stream.
HistoryGap
A gap was detected in the watch stream. The accompanying GapReason explains why.
This variant is surfaced on the watch stream when the supervisor detects either a
non-consecutive sequence number on the wire or a server-emitted
notification_replay_limit_reached signal. The watch terminates after this error
because continuing past a known gap would silently violate at-least-once delivery.
StreamProtocol
A wire-protocol-level fatal condition was observed on the watch stream.
Surfaced when the server emits an error SSE event, when a connection-closing
frame carries an unrecognised reason, or when any other recognised-shape frame is
fundamentally not implementable by this client. The message is taken verbatim from
the server payload when one is provided. request_id carries the server-supplied
correlation id when the payload includes one.
Distinct from ClientError::Http, which describes a non-success HTTP status on the
initial response; StreamProtocol is for fatal frames that arrive over a stream that
initially returned 200.
Fields
Config(String)
Configuration-time error (invalid auth source, missing field, and so on).
StateStore(StoreError)
Persistent state-store operation failed during a watch session.
Surfaced when crate::state::StateStore::get or
crate::state::StateStore::put returns an error while the watch
supervisor is consulting or updating the durable resume cursor.
The supervisor cannot continue at-least-once delivery without a
working store, so this error is terminal: the stream yields None
after it.
The #[from] impl preserves the underlying error chain
(StoreError::Io, StoreError::Decode, and so on) so callers can
classify the root cause via source() if they need to.
TriggerFailed
A required trigger failed after all configured retries.
Surfaced when a crate::watch::Trigger configured on a
crate::watch::WatchRequest with required: true (the default)
exhausts its retry budget. Terminal: the stream yields None
after this error and the supervisor exits.
The committed checkpoint stays at the previous notification’s sequence (or remains unset if the failing trigger was on the very first notification of the session). On next process start the supervisor re-delivers the notification whose trigger failed.
kind names the trigger for diagnostics; source carries the
underlying error (typically a crate::watch::TriggerError::Io).
Fields
kind: TriggerKindLabelKind of trigger that failed (echo or log).
source: TriggerErrorInner error from the trigger dispatcher.
Implementations§
Source§impl ClientError
impl ClientError
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
Returns the server-supplied request-id correlation for variants that carry one,
or None otherwise.
Currently this is ClientError::Http and ClientError::StreamProtocol; the
other variants either represent client-side conditions (ClientError::Config,
ClientError::Auth) or do not reliably carry a server identifier
(ClientError::Transport, ClientError::Decode, ClientError::MalformedEvent,
ClientError::HistoryGap).
Trait Implementations§
Source§impl Debug for ClientError
impl Debug for ClientError
Source§impl Display for ClientError
impl Display for ClientError
Source§impl Error for ClientError
impl Error for ClientError
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()