pub enum OrmError {
Connection(String),
Query(Error),
NotFound(String),
UniqueViolation(String),
ForeignKeyViolation(String),
CheckViolation(String),
Decode {
column: String,
message: String,
},
Validation(String),
Serialization(String),
Pool(String),
Other(String),
}Expand description
Error types for database operations
Variants§
Connection(String)
Database connection error
Query(Error)
Query execution error
NotFound(String)
Row not found
UniqueViolation(String)
Unique constraint violation
ForeignKeyViolation(String)
Foreign key constraint violation
CheckViolation(String)
Check constraint violation
Decode
Row decode/mapping error
Validation(String)
Validation error
Serialization(String)
Serialization error
Pool(String)
Pool error
Other(String)
Other errors
Implementations§
Source§impl OrmError
impl OrmError
Sourcepub fn decode(column: impl Into<String>, message: impl Into<String>) -> Self
pub fn decode(column: impl Into<String>, message: impl Into<String>) -> Self
Create a decode error for a specific column
Sourcepub fn is_unique_violation(&self) -> bool
pub fn is_unique_violation(&self) -> bool
Check if this is a unique violation error
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Check if this is a not found error
Sourcepub fn from_db_error(err: Error) -> Self
pub fn from_db_error(err: Error) -> Self
Parse a tokio_postgres error into a more specific OrmError
Trait Implementations§
Source§impl Error for OrmError
impl Error for OrmError
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 OrmError
impl !RefUnwindSafe for OrmError
impl Send for OrmError
impl Sync for OrmError
impl Unpin for OrmError
impl !UnwindSafe for OrmError
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