solidb_client/protocol/
error.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4pub enum DriverError {
5 ConnectionError(String),
6 ProtocolError(String),
7 DatabaseError(String),
8 AuthError(String),
9 TransactionError(String),
10 MessageTooLarge,
11 InvalidCommand(String),
12 ServerError(String),
13}
14
15impl std::fmt::Display for DriverError {
16 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17 match self {
18 DriverError::ConnectionError(msg) => write!(f, "Connection error: {}", msg),
19 DriverError::ProtocolError(msg) => write!(f, "Protocol error: {}", msg),
20 DriverError::DatabaseError(msg) => write!(f, "Database error: {}", msg),
21 DriverError::AuthError(msg) => write!(f, "Auth error: {}", msg),
22 DriverError::TransactionError(msg) => write!(f, "Transaction error: {}", msg),
23 DriverError::MessageTooLarge => write!(f, "Message too large"),
24 DriverError::InvalidCommand(msg) => write!(f, "Invalid command: {}", msg),
25 DriverError::ServerError(msg) => write!(f, "Server error: {}", msg),
26 }
27 }
28}
29
30impl std::error::Error for DriverError {}