Skip to content

Commit

Permalink
Handle error for exists on MMapDirectory (#1988)
Browse files Browse the repository at this point in the history
`exists` will return false in case of other io errors, like permission denied
  • Loading branch information
PSeitz authored Apr 25, 2023
1 parent 2e369db commit 80df1d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/directory/mmap_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ impl Directory for MmapDirectory {

fn exists(&self, path: &Path) -> Result<bool, OpenReadError> {
let full_path = self.resolve_path(path);
Ok(full_path.exists())
full_path
.try_exists()
.map_err(|io_err| OpenReadError::wrap_io_error(io_err, path.to_path_buf()))
}

fn open_write(&self, path: &Path) -> Result<WritePtr, OpenWriteError> {
Expand Down

0 comments on commit 80df1d9

Please sign in to comment.