Skip to content

Commit

Permalink
remove unused errors from ignore
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <[email protected]>
  • Loading branch information
simonsan committed Oct 27, 2024
1 parent 234cea6 commit cd0989c
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions crates/core/src/backend/ignore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,7 @@ use crate::{
/// [`IgnoreErrorKind`] describes the errors that can be returned by a Ignore action in Backends
#[derive(thiserror::Error, Debug, displaydoc::Display)]
pub enum IgnoreErrorKind {
/// generic Ignore error: `{0:?}`
GenericError(ignore::Error),
/// Error reading glob file `{file:?}`: `{source:?}`
ErrorGlob {
file: PathBuf,
source: std::io::Error,
},
/// Unable to open file `{file:?}`: `{source:?}`
UnableToOpenFile {
file: PathBuf,
source: std::io::Error,
},
#[cfg(all(not(windows), not(target_os = "openbsd")))]
/// Error getting xattrs for `{path:?}`: `{source:?}`
ErrorXattr {
path: PathBuf,
Expand All @@ -64,6 +53,7 @@ pub enum IgnoreErrorKind {
ctime_nsec: i64,
source: TryFromIntError,
},
#[cfg(not(windows))]
/// Error acquiring metadata for `{name}`: `{source:?}`
AcquiringMetadataFailed { name: String, source: ignore::Error },
}
Expand Down Expand Up @@ -178,11 +168,8 @@ impl LocalSource {
///
/// # Errors
///
/// * [`IgnoreErrorKind::GenericError`] - If the a glob pattern could not be added to the override builder.
/// * [`IgnoreErrorKind::FromIoError`] - If a glob file could not be read.
///
/// [`IgnoreErrorKind::GenericError`]: crate::error::IgnoreErrorKind::GenericError
/// [`IgnoreErrorKind::FromIoError`]: crate::error::IgnoreErrorKind::FromIoError
/// * If the a glob pattern could not be added to the override builder.
/// * If a glob file could not be read.
#[allow(clippy::too_many_lines)]
pub fn new(
save_opts: LocalSourceSaveOptions,
Expand Down Expand Up @@ -351,12 +338,14 @@ impl ReadSourceOpen for OpenFile {
/// [`IgnoreErrorKind::UnableToOpenFile`]: crate::error::IgnoreErrorKind::UnableToOpenFile
fn open(self) -> RusticResult<Self::Reader> {
let path = self.0;
File::open(&path)
.map_err(|err| IgnoreErrorKind::UnableToOpenFile {
file: path,
source: err,
})
.map_err(|_err| todo!("Error transition"))
File::open(&path).map_err(|err| {
RusticError::with_source(
ErrorKind::Io,
"Failed to open file. Please make sure the file exists and is accessible.",
err,
)
.attach_context("file", path.display().to_string())
})
}
}

Expand Down

0 comments on commit cd0989c

Please sign in to comment.