#[non_exhaustive]pub enum DatabaseError {
DatabaseEngineError(Error),
QueryBuildingError(Error),
TypeMismatch {
expected: String,
found: String,
},
ValueDecode(Box<dyn Error + Send + Sync + 'static>),
MigrationError(MigrationEngineError),
RecordNotFound {
primary_key: DbValue,
},
ForeignKeyNotFound,
UniqueViolation,
BulkInsertModelTooLarge {
field_count: usize,
limit: usize,
},
BulkInsertNoValueColumns,
BulkInsertReturnDataInvalid {
expected: usize,
actual: usize,
},
}Available on crate feature
db only.Expand description
An error that can occur when interacting with the database.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
DatabaseEngineError(Error)
Database engine error.
QueryBuildingError(Error)
Error when building query.
TypeMismatch
Type mismatch in database value.
ValueDecode(Box<dyn Error + Send + Sync + 'static>)
Error when decoding database value.
MigrationError(MigrationEngineError)
Error when applying migrations.
RecordNotFound
A record could not be found in the database.
ForeignKeyNotFound
Foreign Key could not be retrieved from the database because the record was not found.
UniqueViolation
Error when a unique constraint is violated in the database.
BulkInsertModelTooLarge
Single model has more fields than database parameter limit.
Fields
BulkInsertNoValueColumns
Attempted bulk create with a model that only contains Auto fields.
BulkInsertReturnDataInvalid
Data returned by the bulk insert does not match the expected number of rows.
Implementations§
Source§impl DatabaseError
impl DatabaseError
Sourcepub fn value_decode(error: impl Error + 'static + Send + Sync) -> Self
pub fn value_decode(error: impl Error + 'static + Send + Sync) -> Self
Creates a new database error from a value decode error.
Trait Implementations§
Source§impl Debug for DatabaseError
impl Debug for DatabaseError
Source§impl Display for DatabaseError
impl Display for DatabaseError
Source§impl Error for DatabaseError
impl Error for DatabaseError
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<DatabaseError> for Error
impl From<DatabaseError> for Error
Source§fn from(err: DatabaseError) -> Self
fn from(err: DatabaseError) -> Self
Converts to this type from the input type.
Source§impl From<DatabaseError> for DbStoreError
Available on crate feature json only.
impl From<DatabaseError> for DbStoreError
Available on crate feature
json only.Source§fn from(source: DatabaseError) -> Self
fn from(source: DatabaseError) -> Self
Converts to this type from the input type.
Source§impl From<Error> for DatabaseError
impl From<Error> for DatabaseError
Source§impl From<Error> for DatabaseError
impl From<Error> for DatabaseError
Source§impl From<MigrationEngineError> for DatabaseError
impl From<MigrationEngineError> for DatabaseError
Source§fn from(source: MigrationEngineError) -> Self
fn from(source: MigrationEngineError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for DatabaseError
impl !UnwindSafe for DatabaseError
impl Freeze for DatabaseError
impl Send for DatabaseError
impl Sync for DatabaseError
impl Unpin for DatabaseError
impl UnsafeUnpin for DatabaseError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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>
Converts
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>
Converts
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 moreSource§impl<T> IntoField<Auto<T>> for T
impl<T> IntoField<Auto<T>> for T
Source§fn into_field(self) -> Auto<T>
fn into_field(self) -> Auto<T>
Available on crate feature
db only.Converts the type to the field type.