pub enum DriverError {
Io(Error),
Auth(String),
Protocol(String),
Server {
code: Box<str>,
message: Box<str>,
detail: Option<Box<str>>,
hint: Option<Box<str>>,
position: Option<u32>,
},
Pool(String),
}Expand description
Error type for all bsql-driver-postgres operations.
Variants cover the four failure modes: I/O, authentication, wire protocol violations, server-reported errors, and pool management.
§Example
use bsql_driver_postgres::DriverError;
fn handle_error(err: DriverError) {
match err {
DriverError::Io(e) => eprintln!("network error: {e}"),
DriverError::Auth(msg) => eprintln!("auth failed: {msg}"),
DriverError::Protocol(msg) => eprintln!("protocol error: {msg}"),
DriverError::Server { code, message, position, .. } => {
eprintln!("PG error [{code}]: {message} (pos: {position:?})");
}
DriverError::Pool(msg) => eprintln!("pool error: {msg}"),
}
}Variants§
Io(Error)
TCP/TLS I/O failure.
Auth(String)
Authentication failure (wrong password, unsupported mechanism, etc.).
Protocol(String)
Wire protocol violation (malformed message, unexpected message type, etc.).
Server
Server-reported error (invalid SQL, constraint violation, etc.).
Fields
Pool(String)
Connection pool error (exhaustion, misconfiguration).
Trait Implementations§
Source§impl Debug for DriverError
impl Debug for DriverError
Source§impl Display for DriverError
impl Display for DriverError
Source§impl Error for DriverError
impl Error for DriverError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for DriverError
impl !RefUnwindSafe for DriverError
impl Send for DriverError
impl Sync for DriverError
impl Unpin for DriverError
impl UnsafeUnpin for DriverError
impl !UnwindSafe for DriverError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more