From d9d2120d323e17b93b4b265cc1a795f33d819b3f Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang <93241502+yhchiang-sol@users.noreply.github.com> Date: Tue, 23 May 2023 02:18:23 -0700 Subject: [PATCH] Make reconstruct_single_storage() returns SnapshotError (#31748) #### Problem The return error type -- io::Error used in reconstruct_single_storage() isn't suitable to describe all possible errors inside the function such as AccountsFileError. #### Summary of Changes This PR makes it return SnapshotError which can better handle both AccountsFileError and io::Error. --- runtime/src/serde_snapshot.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/runtime/src/serde_snapshot.rs b/runtime/src/serde_snapshot.rs index 787c56b84..017428f63 100644 --- a/runtime/src/serde_snapshot.rs +++ b/runtime/src/serde_snapshot.rs @@ -629,9 +629,7 @@ pub(crate) fn reconstruct_single_storage( current_len: usize, append_vec_id: AppendVecId, ) -> Result, SnapshotError> { - let (accounts_file, num_accounts) = - AccountsFile::new_from_file(append_vec_path, current_len) - .map_err(|err| io::Error::new(io::ErrorKind::Other, format!("{}", err)))?; + let (accounts_file, num_accounts) = AccountsFile::new_from_file(append_vec_path, current_len)?; Ok(Arc::new(AccountStorageEntry::new_existing( *slot, append_vec_id,