1use thiserror::Error;
2
3#[derive(Debug, Error)]
9pub enum RusticxError {
10 #[error("Connection error: {0}")]
11 Connection(String),
12
13 #[error("Query error: {0}")]
14 Query(String),
15
16 #[error("Serialization error: {0}")]
17 Serialization(String),
18
19 #[error("Deserialization error: {0}")]
20 Deserialization(String),
21
22 #[error("Record not found: {0}")]
23 NotFound(String),
24
25 #[error("Duplicate key: {0}")]
26 DuplicateKey(String),
27
28 #[error("Migration error: {0}")]
29 Migration(String),
30
31 #[error("Schema error: {0}")]
32 Schema(String),
33
34 #[error("Transaction error: {0}")]
35 Transaction(String),
36
37 #[error("Pool error: {0}")]
38 Pool(String),
39
40 #[error("Unsupported operation: {0}")]
41 Unsupported(String),
42
43 #[error("Configuration error: {0}")]
44 Configuration(String),
45
46 #[error("Type mismatch: expected {expected}, got {got}")]
47 TypeMismatch { expected: String, got: String },
48
49 #[error("Unknown error: {0}")]
50 Unknown(String),
51}
52
53pub type Result<T> = std::result::Result<T, RusticxError>;