Improve descriptions of database errors

This commit is contained in:
silverpill 2022-04-20 14:05:09 +00:00
parent 04e851025b
commit 997d9257af
2 changed files with 3 additions and 3 deletions

View file

@ -27,10 +27,10 @@ pub enum DatabaseError {
#[error("database type error")] #[error("database type error")]
DatabaseTypeError(#[from] ConversionError), DatabaseTypeError(#[from] ConversionError),
#[error("{0}")] #[error("{0} not found")]
NotFound(&'static str), // object type NotFound(&'static str), // object type
#[error("{0}")] #[error("{0} already exists")]
AlreadyExists(&'static str), // object type AlreadyExists(&'static str), // object type
} }

View file

@ -521,7 +521,7 @@ mod tests {
..Default::default() ..Default::default()
}; };
let error = create_profile(&db_client, profile_data_2).await.err().unwrap(); let error = create_profile(&db_client, profile_data_2).await.err().unwrap();
assert_eq!(error.to_string(), "profile"); assert_eq!(error.to_string(), "profile already exists");
} }
#[tokio::test] #[tokio::test]