diff --git a/src/archive/tar.rs b/src/archive/tar.rs index 053684171..e92c31dbc 100644 --- a/src/archive/tar.rs +++ b/src/archive/tar.rs @@ -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, output_folder: &Path, flags: &oof::Flags) -> crate::Result> { @@ -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() })?; } } diff --git a/src/error.rs b/src/error.rs index 3792bfb8f..b84220a5c 100644 --- a/src/error.rs +++ b/src/error.rs @@ -205,3 +205,9 @@ impl From for Error { Self::OofError(err) } } + +impl From for Error { + fn from(err: FinalError) -> Self { + Self::Custom { reason: err } + } +}