Skip to content

Commit

Permalink
Make reconstruct_single_storage() returns SnapshotError (#31748)
Browse files Browse the repository at this point in the history
#### 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.
  • Loading branch information
yhchiang-sol committed May 23, 2023
1 parent 7ef4b77 commit d9d2120
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions runtime/src/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d9d2120

Please sign in to comment.