pub enum XdsError {
Show 18 variants
InvalidTypeUrl {
type_url: String,
reason: String,
},
ResourceNotFound {
type_url: String,
name: String,
},
VersionMismatch {
type_url: String,
name: String,
expected: String,
actual: String,
},
InvalidResource {
type_url: String,
name: String,
reason: String,
},
CacheError {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
WatchError {
message: String,
},
SnapshotIncomplete {
missing_types: Vec<String>,
},
EncodingError {
type_url: String,
message: String,
},
DecodingError {
type_url: String,
message: String,
},
TransportError {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
StreamClosed {
reason: String,
},
NackReceived {
node_id: String,
type_url: String,
nonce: String,
error_message: String,
},
Timeout {
operation: String,
},
Shutdown,
RateLimited {
message: String,
},
Internal {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
WatchClosed {
watch_id: u64,
},
Configuration(String),
}Expand description
Comprehensive error type for xDS operations.
This error type is designed to:
- Cover all failure modes without using panics
- Properly convert to
tonic::Statusfor gRPC responses - Provide detailed error messages for debugging
- Support error chaining via the
sourcefield
§Example
use xds_core::XdsError;
fn validate_resource(name: &str) -> Result<(), XdsError> {
if name.is_empty() {
return Err(XdsError::InvalidResource {
type_url: "type.googleapis.com/envoy.config.cluster.v3.Cluster".to_string(),
name: name.to_string(),
reason: "resource name cannot be empty".to_string(),
});
}
Ok(())
}Variants§
InvalidTypeUrl
Malformed or unknown type URL.
ResourceNotFound
Requested resource doesn’t exist in the cache.
VersionMismatch
Version conflict during update.
Fields
InvalidResource
Resource validation failed.
Fields
CacheError
Cache operation failed.
Fields
WatchError
Watch creation or notification failed.
SnapshotIncomplete
Snapshot is incomplete - missing required resource types.
EncodingError
Protobuf encoding failed.
DecodingError
Protobuf decoding failed.
TransportError
gRPC transport error.
Fields
StreamClosed
Client stream closed unexpectedly.
NackReceived
Client rejected configuration (NACK).
Fields
Timeout
Operation timed out.
Shutdown
Server is shutting down.
RateLimited
Too many requests (rate limited).
Internal
Unexpected internal error.
Fields
WatchClosed
Watch subscription was closed.
Configuration(String)
Configuration error.
Implementations§
Trait Implementations§
Source§impl Error for XdsError
impl Error for XdsError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for XdsError
impl !RefUnwindSafe for XdsError
impl Send for XdsError
impl Sync for XdsError
impl Unpin for XdsError
impl UnsafeUnpin for XdsError
impl !UnwindSafe for XdsError
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
Mutably borrows from an owned value. Read more
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>
Wrap the input message
T in a tonic::Request