Improved error message.

This commit is contained in:
Jeff Baskin 2022-12-03 08:26:21 -05:00
parent 8eb916771e
commit 4e4344624e

View File

@ -15,7 +15,7 @@ impl MoreThanText {
match create_dir(data_dir).await { match create_dir(data_dir).await {
Ok(_) => (), Ok(_) => (),
Err(err) => { Err(err) => {
let mut error = DBError::new("failed to initialize"); let mut error = DBError::new("failed to create data directory");
error.add_source(err); error.add_source(err);
return Err(error); return Err(error);
} }
@ -58,7 +58,7 @@ mod init {
match MoreThanText::new("kljsdgfhslkfrh").await { match MoreThanText::new("kljsdgfhslkfrh").await {
Ok(_) => assert!(false, "This test should fail to create a data directory"), Ok(_) => assert!(false, "This test should fail to create a data directory"),
Err(err) => { Err(err) => {
assert_eq!(err.to_string(), "failed to initialize"); assert_eq!(err.to_string(), "failed to create data directory");
assert!(err.source().is_some(), "Must include the source error."); assert!(err.source().is_some(), "Must include the source error.");
} }
}; };