Added error codes to store.

This commit is contained in:
2023-03-15 07:38:39 -04:00
parent a3d8feb37a
commit e125d79a6c
2 changed files with 35 additions and 26 deletions

View File

@ -312,9 +312,9 @@ mod datatype_file {
let mut feed = data.iter();
match DataType::from_bytes(&mut feed) {
Ok(_) => Err(DBError::new("should have raised an error")),
Err(err) => {
assert_eq!(err.to_string(), "file corruption");
Ok(())
Err(err) => match err.code {
ErrorCode::CorruptFile => Ok(()),
_ => Err(DBError::new("incorrect error code")),
}
}
}