pub enum Error {
Json(Error),
Yaml(Error),
Text(String),
Xml(String),
}
Expand description
Comprehensive error types that can occur when working with namespaces.
This enum covers all possible error conditions that may arise during namespace operations, from format detection to parsing and type conversion failures.
§Error Categories
- JSON Errors: Issues with JSON namespace processing and deserialization
- YAML Errors: Issues with YAML namespace processing and deserialization
- Text Errors: Issues with text content extraction and processing
- XML Errors: Issues with XML format (currently unsupported)
§Examples
use apollo_rust_client::namespace::{Namespace, Error};
use serde_json::json;
// Create a sample JSON value
let json_value = json!({
"content": r#"{"name": "test", "value": 42}"#
});
// This would typically be done through the client, but for demonstration:
// The error handling shows how different namespace errors are handled
fn handle_namespace_error(error: Error) {
match error {
Error::Json(json_error) => {
// Handle JSON-specific errors
eprintln!("JSON error: {}", json_error);
}
Error::Yaml(yaml_error) => {
// Handle YAML-specific errors
eprintln!("YAML error: {}", yaml_error);
}
Error::Text(text_error) => {
// Handle text-specific errors
eprintln!("Text error: {}", text_error);
}
Error::Xml(xml_error) => {
// Handle XML-specific errors (currently unsupported)
eprintln!("XML error: {}", xml_error);
}
}
}
Variants§
Json(Error)
Failed to process JSON namespace.
This error occurs when there are issues with JSON format detection, parsing, or deserialization operations specific to JSON namespaces.
Yaml(Error)
Failed to process YAML namespace.
This error occurs when there are issues with YAML format detection, parsing, or deserialization operations specific to YAML namespaces.
Text(String)
Failed to process text namespace.
This error occurs when there are issues with text content extraction or processing from the configuration data.
Xml(String)
Failed to process XML namespace.
This error occurs when XML format is detected but XML processing is not yet supported by the library.
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.