Introduce a new bincode internal error

This commit is contained in:
Clément Renault 2024-11-20 13:23:11 +01:00
parent fe5d50969a
commit 7cb8732b45
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F
2 changed files with 3 additions and 2 deletions

View File

@ -56,6 +56,8 @@ pub enum InternalError {
#[error(transparent)]
SerdeJson(#[from] serde_json::Error),
#[error(transparent)]
BincodeError(#[from] bincode::Error),
#[error(transparent)]
Serialization(#[from] SerializationError),
#[error(transparent)]
Store(#[from] MdbError),

View File

@ -48,8 +48,7 @@ where
}
let mut file = tempfile::tempfile()?;
/// manage error
bincode::serialize_into(&mut file, &rtree).unwrap();
bincode::serialize_into(&mut file, &rtree).map_err(InternalError::BincodeError)?;
file.sync_all()?;
let rtree_mmap = unsafe { Mmap::map(&file)? };