pub enum Error {
Show 18 variants
Io(Error),
Protocol(String),
Server(Box<ServerError>),
Auth(String),
Tls(String),
Pool(String),
Config(String),
Encode(String),
Decode(String),
ColumnNotFound(String),
ColumnIndex {
index: usize,
count: usize,
},
UnexpectedNull(usize),
Timeout(String),
ConnectionClosed,
Copy(String),
TransactionCompleted,
AllHostsFailed(String),
WrongSessionAttrs(String),
}Expand description
All possible errors from sentinel-driver.
Variants§
Io(Error)
I/O error from TCP/TLS stream.
Protocol(String)
PostgreSQL protocol error (unexpected message, malformed packet, etc.).
Server(Box<ServerError>)
Error returned by the PostgreSQL server.
Auth(String)
Authentication failure.
Tls(String)
TLS/SSL negotiation error.
Pool(String)
Connection pool error.
Config(String)
Invalid configuration.
Encode(String)
Type encoding error (Rust → PG).
Decode(String)
Type decoding error (PG → Rust).
ColumnNotFound(String)
Column not found by name.
ColumnIndex
Column index out of bounds.
UnexpectedNull(usize)
Unexpected null value.
Timeout(String)
Timeout (connect, query, pool checkout).
ConnectionClosed
Connection is closed or broken.
Copy(String)
COPY protocol error.
TransactionCompleted
Transaction already completed (committed or rolled back).
AllHostsFailed(String)
All configured hosts failed to connect.
WrongSessionAttrs(String)
Connected server does not match required session attributes.
Implementations§
Source§impl Error
impl Error
Sourcepub fn server_error(&self) -> Option<&ServerError>
pub fn server_error(&self) -> Option<&ServerError>
Returns the server error details if this is a server error.
Sourcepub fn is_unique_violation(&self) -> bool
pub fn is_unique_violation(&self) -> bool
Returns true if this error represents a unique violation (SQLSTATE 23505).
Sourcepub fn is_foreign_key_violation(&self) -> bool
pub fn is_foreign_key_violation(&self) -> bool
Returns true if this error represents a foreign key violation (SQLSTATE 23503).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()