From 36a560ccb38a4dcf9f3249ca534653bb329f9d4b Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Sun, 22 Feb 2026 21:14:04 +0100 Subject: [PATCH] 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 --- data/src/providers/common.rs | 8 ++++---- ml/src/lib.rs | 11 ++--------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/data/src/providers/common.rs b/data/src/providers/common.rs index 248df6064..4a263dc26 100644 --- a/data/src/providers/common.rs +++ b/data/src/providers/common.rs @@ -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 diff --git a/ml/src/lib.rs b/ml/src/lib.rs index 6a6375140..65279613b 100644 --- a/ml/src/lib.rs +++ b/ml/src/lib.rs @@ -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