oxigdal_cloud_enhanced/
error.rs1pub type Result<T> = std::result::Result<T, CloudEnhancedError>;
5
6#[derive(Debug, thiserror::Error)]
8pub enum CloudEnhancedError {
9 #[error("AWS service error: {0}")]
11 AwsService(String),
12
13 #[error("Azure service error: {0}")]
15 AzureService(String),
16
17 #[error("GCP service error: {0}")]
19 GcpService(String),
20
21 #[error("Authentication error: {0}")]
23 Authentication(String),
24
25 #[error("Query execution error: {0}")]
27 QueryExecution(String),
28
29 #[error("Data catalog error: {0}")]
31 DataCatalog(String),
32
33 #[error("ML service error: {0}")]
35 MlService(String),
36
37 #[error("Monitoring error: {0}")]
39 Monitoring(String),
40
41 #[error("Cost optimization error: {0}")]
43 CostOptimization(String),
44
45 #[error("Configuration error: {0}")]
47 Configuration(String),
48
49 #[error("Serialization error: {0}")]
51 Serialization(String),
52
53 #[error("IO error: {0}")]
55 Io(#[from] std::io::Error),
56
57 #[error("Arrow error: {0}")]
59 Arrow(String),
60
61 #[error("Parquet error: {0}")]
63 Parquet(String),
64
65 #[error("Invalid state: {0}")]
67 InvalidState(String),
68
69 #[error("Operation timed out: {0}")]
71 Timeout(String),
72
73 #[error("Resource not found: {0}")]
75 NotFound(String),
76
77 #[error("Permission denied: {0}")]
79 PermissionDenied(String),
80
81 #[error("Quota exceeded: {0}")]
83 QuotaExceeded(String),
84
85 #[error("Invalid argument: {0}")]
87 InvalidArgument(String),
88
89 #[error("{0}")]
91 Generic(String),
92}
93
94impl CloudEnhancedError {
95 pub fn aws_service(msg: impl Into<String>) -> Self {
97 Self::AwsService(msg.into())
98 }
99
100 pub fn azure_service(msg: impl Into<String>) -> Self {
102 Self::AzureService(msg.into())
103 }
104
105 pub fn gcp_service(msg: impl Into<String>) -> Self {
107 Self::GcpService(msg.into())
108 }
109
110 pub fn authentication(msg: impl Into<String>) -> Self {
112 Self::Authentication(msg.into())
113 }
114
115 pub fn query_execution(msg: impl Into<String>) -> Self {
117 Self::QueryExecution(msg.into())
118 }
119
120 pub fn data_catalog(msg: impl Into<String>) -> Self {
122 Self::DataCatalog(msg.into())
123 }
124
125 pub fn ml_service(msg: impl Into<String>) -> Self {
127 Self::MlService(msg.into())
128 }
129
130 pub fn monitoring(msg: impl Into<String>) -> Self {
132 Self::Monitoring(msg.into())
133 }
134
135 pub fn cost_optimization(msg: impl Into<String>) -> Self {
137 Self::CostOptimization(msg.into())
138 }
139
140 pub fn configuration(msg: impl Into<String>) -> Self {
142 Self::Configuration(msg.into())
143 }
144
145 pub fn serialization(msg: impl Into<String>) -> Self {
147 Self::Serialization(msg.into())
148 }
149
150 pub fn arrow(msg: impl Into<String>) -> Self {
152 Self::Arrow(msg.into())
153 }
154
155 pub fn parquet(msg: impl Into<String>) -> Self {
157 Self::Parquet(msg.into())
158 }
159
160 pub fn invalid_state(msg: impl Into<String>) -> Self {
162 Self::InvalidState(msg.into())
163 }
164
165 pub fn timeout(msg: impl Into<String>) -> Self {
167 Self::Timeout(msg.into())
168 }
169
170 pub fn not_found(msg: impl Into<String>) -> Self {
172 Self::NotFound(msg.into())
173 }
174
175 pub fn permission_denied(msg: impl Into<String>) -> Self {
177 Self::PermissionDenied(msg.into())
178 }
179
180 pub fn quota_exceeded(msg: impl Into<String>) -> Self {
182 Self::QuotaExceeded(msg.into())
183 }
184
185 pub fn invalid_argument(msg: impl Into<String>) -> Self {
187 Self::InvalidArgument(msg.into())
188 }
189
190 pub fn generic(msg: impl Into<String>) -> Self {
192 Self::Generic(msg.into())
193 }
194}
195
196impl From<serde_json::Error> for CloudEnhancedError {
197 fn from(err: serde_json::Error) -> Self {
198 Self::serialization(err.to_string())
199 }
200}
201
202impl From<arrow::error::ArrowError> for CloudEnhancedError {
203 fn from(err: arrow::error::ArrowError) -> Self {
204 Self::arrow(err.to_string())
205 }
206}
207
208impl From<parquet::errors::ParquetError> for CloudEnhancedError {
209 fn from(err: parquet::errors::ParquetError) -> Self {
210 Self::parquet(err.to_string())
211 }
212}