Skip to main content

chronix_analytics/
error.rs

1//! Error types for the analytics system.
2
3use thiserror::Error;
4
5/// Errors that can occur in the analytics system.
6#[derive(Debug, Error)]
7pub enum AnalyticsError {
8    /// Configuration error.
9    #[error("Analytics config error: {0}")]
10    Config(String),
11    /// Anomaly detection error.
12    #[error("Anomaly detection error: {0}")]
13    Anomaly(#[from] crate::anomaly::AnomalyError),
14    /// Forecast error.
15    #[error("Forecast error: {0}")]
16    Forecast(#[from] crate::forecast::ForecastError),
17    /// Series not found / not configured.
18    #[error("Series not configured: {0}")]
19    NotConfigured(String),
20    /// Duplicate configuration.
21    #[error("Duplicate configuration: {0}")]
22    Duplicate(String),
23    /// Internal error.
24    #[error("Analytics internal error: {0}")]
25    Internal(String),
26}
27
28/// Result alias for analytics operations.
29pub type Result<T> = std::result::Result<T, AnalyticsError>;