pub enum CkanError {
RequestError(Box<dyn Error + Send + Sync>),
ParseError(Error),
ApiError {
status: u16,
message: String,
},
}Expand description
Errors that can occur when interacting with the CKAN API
This enum provides detailed error information for different types of failures that can occur during CKAN API operations.
§Examples
match some_api_call().await {
Ok(result) => println!("Success: {:?}", result),
Err(CkanError::RequestError(e)) => {
eprintln!("Network or HTTP error: {}", e);
},
Err(CkanError::ParseError(e)) => {
eprintln!("Failed to parse API response: {}", e);
},
Err(CkanError::ApiError { status, message }) => {
eprintln!("CKAN API returned error {}: {}", status, message);
}
}Variants§
RequestError(Box<dyn Error + Send + Sync>)
Network, HTTP, or other request-level errors
This includes connection failures, timeouts, DNS resolution issues, and HTTP protocol errors (like 500 Internal Server Error).
ParseError(Error)
JSON parsing or deserialization errors
Occurs when the CKAN API returns data that doesn’t match expected schema, invalid JSON, or when response format has changed.
ApiError
CKAN-specific API errors with status codes
These are semantic errors from CKAN itself, like:
- 404: Dataset not found
- 403: Insufficient permissions
- 400: Invalid parameters
- 409: Resource conflicts
Trait Implementations§
Source§impl Error for CkanError
impl Error for CkanError
1.30.0 · 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 !RefUnwindSafe for CkanError
impl !UnwindSafe for CkanError
impl Freeze for CkanError
impl Send for CkanError
impl Sync for CkanError
impl Unpin for CkanError
impl UnsafeUnpin for CkanError
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> 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.