pub struct DbError { /* private fields */ }Expand description
A failure reported by a driver.
Its Display is the driver’s own account, which is what gets logged.
Converted to Error it is the database’s error where PostgreSQL sent
one – SQLSTATE, message, detail, hint, constraint – a connection error
where the connection could not be used, and an internal error otherwise.
Implementations§
Source§impl DbError
impl DbError
Sourcepub fn other(message: impl Into<String>) -> Self
pub fn other(message: impl Into<String>) -> Self
A failure that is not PostgreSQL’s: a protocol or decoding fault.
Sourcepub fn connection(message: impl Into<String>) -> Self
pub fn connection(message: impl Into<String>) -> Self
A connection that cannot be used: one that could not be opened in time, was closed, or failed reading or writing.
Sourcepub fn database(message: impl Into<String>, error: DatabaseError) -> Self
pub fn database(message: impl Into<String>, error: DatabaseError) -> Self
An error PostgreSQL reported, with message as the driver phrased it.
Sourcepub fn as_database(&self) -> Option<&DatabaseError>
pub fn as_database(&self) -> Option<&DatabaseError>
The error PostgreSQL reported, if it was one.
Sourcepub fn is_connection(&self) -> bool
pub fn is_connection(&self) -> bool
Whether the connection was what failed, rather than a statement on it.
Sourcepub fn was_queued(&self) -> bool
pub fn was_queued(&self) -> bool
Whether a Tx::queued statement failed, rather than the one it was
reported by – a pre-request function refusing the request, say.
Trait Implementations§
Source§impl Error for DbError
impl Error for DbError
1.30.0 · 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()
Auto Trait Implementations§
impl Freeze for DbError
impl RefUnwindSafe for DbError
impl Send for DbError
impl Sync for DbError
impl Unpin for DbError
impl UnsafeUnpin for DbError
impl UnwindSafe for DbError
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more