Skip to main content

systemprompt_analytics/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum AnalyticsError {
5    #[error("Session not found: {0}")]
6    SessionNotFound(String),
7
8    #[error("Invalid fingerprint hash: {0}")]
9    InvalidFingerprint(String),
10
11    #[error("Database error: {0}")]
12    Database(#[from] sqlx::Error),
13
14    #[error("Session expired")]
15    SessionExpired,
16
17    #[error("Throttle level exceeded")]
18    ThrottleLevelExceeded,
19
20    #[error("Behavioral bot detected: {0}")]
21    BehavioralBotDetected(String),
22
23    #[error("Anomaly detection failed: {0}")]
24    AnomalyDetectionFailed(String),
25}
26
27pub type Result<T> = std::result::Result<T, AnalyticsError>;