From 7cb8732b458add65a3f13e0a84df98ac234ad72e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 20 Nov 2024 13:23:11 +0100 Subject: [PATCH] Introduce a new bincode internal error --- crates/milli/src/error.rs | 2 ++ crates/milli/src/update/new/merger.rs | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/milli/src/error.rs b/crates/milli/src/error.rs index 3a9c81e10..6c60dcecc 100644 --- a/crates/milli/src/error.rs +++ b/crates/milli/src/error.rs @@ -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), diff --git a/crates/milli/src/update/new/merger.rs b/crates/milli/src/update/new/merger.rs index 9d0d8e176..f6876b3d9 100644 --- a/crates/milli/src/update/new/merger.rs +++ b/crates/milli/src/update/new/merger.rs @@ -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)? };