pub enum AppError {
}Variants§
DatabaseError(Error)
Database operation failed.
This error wraps all errors from SQLx database operations, including connection failures, query errors, and constraint violations.
ClientError(String)
HTTP client request failed.
This error occurs when HTTP requests fail due to network issues, timeouts, or server errors.
GeminiError(GeminiErrorDetails)
Gemini API call failed.
This error occurs when Gemini API calls fail, including authentication failures, rate limiting, and API errors. Contains structured error information for better error handling.
SerializationError(Error)
JSON serialization or deserialization failed.
This error occurs when converting between Rust types and JSON, typically when parsing API responses or preparing database values.
InvalidUrl(String)
URL parsing failed.
This error occurs when attempting to parse an invalid URL string, typically when constructing API endpoints or validating portal URLs.
DatasetNotFound(String)
Dataset not found in the database.
This error indicates that a requested dataset does not exist.
InvalidPortalUrl(String)
Invalid CKAN portal URL provided.
This error occurs when the provided CKAN portal URL is malformed or cannot be used to construct valid API endpoints.
EmptyResponse
API response contained no data.
This error occurs when an API returns a successful status but the response body is empty or missing expected data.
NetworkError(String)
Network or connection error.
This error occurs when a network request fails due to connectivity issues, DNS resolution failures, or the remote server being unreachable.
Timeout(u64)
Request timeout.
This error occurs when a request takes longer than the configured timeout.
RateLimitExceeded
Rate limit exceeded.
This error occurs when too many requests are made in a short period.
ConfigError(String)
Configuration file error.
This error occurs when reading or parsing the configuration file fails, such as when the portals.toml file is malformed or contains invalid values.
Generic(String)
Generic application error for cases not covered by specific variants.
Use this sparingly - prefer creating specific error variants for better error handling and debugging.
Implementations§
Source§impl AppError
impl AppError
Sourcepub fn user_message(&self) -> String
pub fn user_message(&self) -> String
Returns a user-friendly error message suitable for CLI output.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if this error is retryable.
§Examples
use ceres_core::error::AppError;
// Network errors are retryable
let err = AppError::NetworkError("connection reset".to_string());
assert!(err.is_retryable());
// Rate limits are retryable (after a delay)
let err = AppError::RateLimitExceeded;
assert!(err.is_retryable());
// Dataset not found is NOT retryable
let err = AppError::DatasetNotFound("test".to_string());
assert!(!err.is_retryable());Trait Implementations§
Source§impl Error for AppError
impl Error for AppError
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 AppError
impl !RefUnwindSafe for AppError
impl Send for AppError
impl Sync for AppError
impl Unpin for AppError
impl !UnwindSafe for AppError
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more