pub enum Error {
AlreadyRunning,
Namespace(Error),
Cache(Error),
}
Expand description
Comprehensive error types that can occur when using the Apollo client.
This enum covers all possible error conditions that may arise during client operations, from initialization and configuration to runtime cache operations and namespace handling.
§Error Categories
- Client State Errors: Issues related to client lifecycle management
- Namespace Errors: Problems with namespace format detection and processing
- Cache Errors: Network, I/O, and caching-related failures
§Examples
use apollo_rust_client::{Client, Error};
match client.namespace("application").await {
Ok(namespace) => {
// Handle successful namespace retrieval
}
Err(Error::Cache(cache_error)) => {
// Handle cache-related errors (network, parsing, etc.)
eprintln!("Cache error: {}", cache_error);
}
Err(Error::Namespace(namespace_error)) => {
// Handle namespace-related errors (format detection, etc.)
eprintln!("Namespace error: {}", namespace_error);
}
Err(e) => {
// Handle other errors
eprintln!("Error: {}", e);
}
}
Variants§
AlreadyRunning
The client background task is already running.
This error occurs when attempting to start a client that is already running its background refresh task. Each client instance can only have one active background task at a time.
Namespace(Error)
An error occurred during namespace processing.
This includes errors from format detection, parsing, or type conversion operations specific to namespace handling.
Cache(Error)
An error occurred during cache operations.
This encompasses network errors, I/O failures, serialization issues, and other cache-related problems during configuration retrieval or storage.
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
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin 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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.