Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/revlog/revlog.rs @ 47991:001d747c2baf
rust: Return HgError instead of RevlogError in revlog constructors
This leaves fewer cases for callers to handle, as RevlogError is more general
Differential Revision: https://phab.mercurial-scm.org/D11410
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 13 Sep 2021 18:02:45 +0200 |
parents | 8c29af0f6d6e |
children | 6c653d9d41b8 |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/revlog.rs Mon Sep 13 17:23:42 2021 +0200 +++ b/rust/hg-core/src/revlog/revlog.rs Mon Sep 13 18:02:45 2021 +0200 @@ -68,14 +68,14 @@ repo: &Repo, index_path: impl AsRef<Path>, data_path: Option<&Path>, - ) -> Result<Self, RevlogError> { + ) -> Result<Self, HgError> { let index_path = index_path.as_ref(); let index_mmap = repo.store_vfs().mmap_open(&index_path)?; let version = get_version(&index_mmap); if version != 1 { // A proper new version should have had a repo/store requirement. - return Err(RevlogError::corrupted()); + return Err(HgError::corrupted("corrupted revlog")); } let index = Index::new(Box::new(index_mmap))?;