Fix typo in error name (#1180)

* fix typo in error name

* fixed typo in docs

Co-authored-by: erhodes <erik@space-nav.com>
This commit is contained in:
e-rhodes 2022-11-06 00:18:07 -06:00 committed by GitHub
parent 31a8895e39
commit 69612fa507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -33,10 +33,10 @@ pub enum DbErr {
/// After an insert statement it was impossible to retrieve the last_insert_id /// After an insert statement it was impossible to retrieve the last_insert_id
#[error("Failed to unpack last_insert_id")] #[error("Failed to unpack last_insert_id")]
UnpackInsertId, UnpackInsertId,
/// When updating, a model should know it's primary key to check /// When updating, a model should know its primary key to check
/// if the record has been correctly updated, otherwise this error will occur /// if the record has been correctly updated, otherwise this error will occur
#[error("Failed to get primary key from model")] #[error("Failed to get primary key from model")]
UpdateGetPrimeryKey, UpdateGetPrimaryKey,
/// The record was not found in the database /// The record was not found in the database
#[error("RecordNotFound Error: {0}")] #[error("RecordNotFound Error: {0}")]
RecordNotFound(String), RecordNotFound(String),

View File

@ -116,7 +116,7 @@ where
Updater::new(query).check_record_exists().exec(db).await?; Updater::new(query).check_record_exists().exec(db).await?;
let primary_key_value = match model.get_primary_key_value() { let primary_key_value = match model.get_primary_key_value() {
Some(val) => FromValueTuple::from_value_tuple(val), Some(val) => FromValueTuple::from_value_tuple(val),
None => return Err(DbErr::UpdateGetPrimeryKey), None => return Err(DbErr::UpdateGetPrimaryKey),
}; };
let found = <A::Entity as EntityTrait>::find_by_id(primary_key_value) let found = <A::Entity as EntityTrait>::find_by_id(primary_key_value)
.one(db) .one(db)