refactor(ml): remove stub ErrorCategory, use common::error::ErrorCategory
The ml crate had a stub ErrorCategory with only 1 variant (System). Replace it with a re-export of the canonical 24-variant ErrorCategory from common::error. Also rename the unused ErrorCategory in data/src/providers/common.rs to ProviderErrorCategory to avoid name collision. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -47,14 +47,14 @@ use serde::{Deserialize, Serialize};
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use data::providers::common::ErrorCategory;
|
||||
/// use data::providers::common::ProviderErrorCategory;
|
||||
///
|
||||
/// match error_category {
|
||||
/// ErrorCategory::RateLimit => {
|
||||
/// ProviderErrorCategory::RateLimit => {
|
||||
/// // Implement exponential backoff
|
||||
/// tokio::time::sleep(Duration::from_millis(1000)).await;
|
||||
/// },
|
||||
/// ErrorCategory::Authentication => {
|
||||
/// ProviderErrorCategory::Authentication => {
|
||||
/// // Refresh credentials and reconnect
|
||||
/// provider.refresh_auth().await?;
|
||||
/// },
|
||||
@@ -64,7 +64,7 @@ use serde::{Deserialize, Serialize};
|
||||
/// }
|
||||
/// ```
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum ErrorCategory {
|
||||
pub enum ProviderErrorCategory {
|
||||
/// Network connectivity issues, WebSocket disconnections
|
||||
///
|
||||
/// Indicates problems with the underlying network connection to the
|
||||
|
||||
@@ -457,15 +457,8 @@ impl CommonError {
|
||||
}
|
||||
}
|
||||
|
||||
/// Error categories for system-wide error classification
|
||||
///
|
||||
/// This enum provides a way to categorize errors across the entire system,
|
||||
/// enabling better error handling, logging, and monitoring strategies.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
pub enum ErrorCategory {
|
||||
/// System-level errors including hardware, network, and infrastructure issues
|
||||
System,
|
||||
}
|
||||
// Re-export canonical ErrorCategory from common crate (24 variants)
|
||||
pub use ::common::error::ErrorCategory;
|
||||
|
||||
// Now using real types from common crate
|
||||
|
||||
|
||||
Reference in New Issue
Block a user