pub struct DbError(/* private fields */);Expand description
A database failure as the guest sees it: the Postgres error fields when
the server reported one, and a DbErrorKind either way. Boxed so a
Result<_, DbError> stays a pointer wide; the fields read through
Deref.
Implementations§
Source§impl DbError
impl DbError
Sourcepub fn new(kind: DbErrorKind, message: impl Into<String>) -> Self
pub fn new(kind: DbErrorKind, message: impl Into<String>) -> Self
An error raised outside the server, with no Postgres fields.
What every database call returns where there is no platform to run it.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
A serialization failure or deadlock: the transaction may succeed if run again.
pub fn is_constraint_violation(&self) -> bool
Trait Implementations§
Source§impl Deref for DbError
impl Deref for DbError
Source§type Target = DbErrorFields
type Target = DbErrorFields
The resulting type after dereferencing.
Source§fn deref(&self) -> &DbErrorFields
fn deref(&self) -> &DbErrorFields
Dereferences the value.
Source§impl DerefMut for DbError
impl DerefMut for DbError
Source§fn deref_mut(&mut self) -> &mut DbErrorFields
fn deref_mut(&mut self) -> &mut DbErrorFields
Mutably dereferences the value.
Source§impl<'de> Deserialize<'de> for DbError
impl<'de> Deserialize<'de> for DbError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for DbError
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)>
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()
Source§impl From<DbErrorFields> for DbError
impl From<DbErrorFields> for DbError
Source§fn from(fields: DbErrorFields) -> Self
fn from(fields: DbErrorFields) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for DbError
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
Mutably borrows from an owned value. Read more