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.
This commit is contained in:
Yueh-Hsuan Chiang 2023-05-23 02:18:23 -07:00 committed by GitHub
parent 7ef4b776ea
commit d9d2120d32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -629,9 +629,7 @@ pub(crate) fn reconstruct_single_storage(
current_len: usize,
append_vec_id: AppendVecId,
) -> Result<Arc<AccountStorageEntry>, 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,