Skip to main content

fraiseql_error/
integration.rs

1#[derive(Debug, thiserror::Error)]
2pub enum IntegrationError {
3    #[error("Search provider error: {provider} - {message}")]
4    Search { provider: String, message: String },
5
6    #[error("Cache error: {message}")]
7    Cache { message: String },
8
9    #[error("Queue error: {message}")]
10    Queue { message: String },
11
12    #[error("Connection failed: {service}")]
13    ConnectionFailed { service: String },
14
15    #[error("Timeout: {operation}")]
16    Timeout { operation: String },
17}
18
19impl IntegrationError {
20    pub const fn error_code(&self) -> &'static str {
21        match self {
22            Self::Search { .. } => "integration_search_error",
23            Self::Cache { .. } => "integration_cache_error",
24            Self::Queue { .. } => "integration_queue_error",
25            Self::ConnectionFailed { .. } => "integration_connection_failed",
26            Self::Timeout { .. } => "integration_timeout",
27        }
28    }
29}