pub struct DbErrorInfo {
pub detail: String,
pub sqlstate: Option<String>,
pub constraint: Option<String>,
}Expand description
Structured information extracted from a driver-level database error.
Produced by cratestack-sqlx’s cool_error_from_sqlx when the
underlying sqlx::Error carries a typed DatabaseError (e.g.
PgDatabaseError). Consumers can inspect constraint and code without
substring-matching the stringified error message.
Fields§
§detail: StringThe operator-visible detail string (equivalent to error.to_string()).
sqlstate: Option<String>The five-character SQLSTATE code ("23505" for unique_violation, etc.).
None when the driver did not surface a code.
constraint: Option<String>The constraint name reported by the database ("accounts_email_key",
etc.). None when the error is not constraint-related.
Trait Implementations§
Source§impl Clone for DbErrorInfo
impl Clone for DbErrorInfo
Source§fn clone(&self) -> DbErrorInfo
fn clone(&self) -> DbErrorInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DbErrorInfo
impl Debug for DbErrorInfo
Source§impl Default for DbErrorInfo
impl Default for DbErrorInfo
Source§fn default() -> DbErrorInfo
fn default() -> DbErrorInfo
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DbErrorInfo
impl<'de> Deserialize<'de> for DbErrorInfo
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
Source§impl Hash for DbErrorInfo
impl Hash for DbErrorInfo
Source§impl PartialEq for DbErrorInfo
impl PartialEq for DbErrorInfo
Source§impl Serialize for DbErrorInfo
impl Serialize for DbErrorInfo
impl Eq for DbErrorInfo
impl StructuralPartialEq for DbErrorInfo
Auto Trait Implementations§
impl Freeze for DbErrorInfo
impl RefUnwindSafe for DbErrorInfo
impl Send for DbErrorInfo
impl Sync for DbErrorInfo
impl Unpin for DbErrorInfo
impl UnsafeUnpin for DbErrorInfo
impl UnwindSafe for DbErrorInfo
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