Skip to content

Commit

Permalink
Solved FinalError compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospb19 committed Oct 29, 2021
1 parent 7bb7643 commit 2512679
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/archive/tar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use walkdir::WalkDir;
use crate::{
error::FinalError,
info, oof,
utils::{self, to_utf, Bytes},
utils::{self, Bytes},
};

pub fn unpack_archive(reader: Box<dyn Read>, output_folder: &Path, flags: &oof::Flags) -> crate::Result<Vec<PathBuf>> {
Expand Down Expand Up @@ -60,17 +60,11 @@ where
builder.append_dir(path, path)?;
} else {
let mut file = fs::File::open(path)?;
dbg!(&path);
dbg!(&file);
dbg!(&entry);
dbg!(&previous_location);
dbg!(&filename);

// builder.append_file(path, file.file_mut())?;
builder.append_file(path, file.file_mut()).map_err(|err| {
FinalError::with_title(format!("Could not create archive '{}'", to_utf(path.clone()))) // output_path == writer? da
.detail(format!("Unexpected error while trying to read file '{}'", to_utf(output_path)))
FinalError::with_title("Could not create archive")
.detail("Unexpected error while trying to read file")
.detail(format!("Error: {}.", err))
.into_owned()
})?;
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,9 @@ impl From<oof::OofError> for Error {
Self::OofError(err)
}
}

impl From<FinalError> for Error {
fn from(err: FinalError) -> Self {
Self::Custom { reason: err }
}
}

0 comments on commit 2512679

Please sign in to comment.