Solved FinalError compile errors

This commit is contained in:
João M. Bezerra 2021-10-29 17:27:48 -03:00 committed by Gabriel Simonetto
parent 09b050d836
commit 6c6f721f35
2 changed files with 10 additions and 10 deletions

View File

@ -13,7 +13,7 @@ use walkdir::WalkDir;
use crate::{ use crate::{
error::FinalError, error::FinalError,
info, oof, 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>> { pub fn unpack_archive(reader: Box<dyn Read>, output_folder: &Path, flags: &oof::Flags) -> crate::Result<Vec<PathBuf>> {
@ -60,17 +60,11 @@ where
builder.append_dir(path, path)?; builder.append_dir(path, path)?;
} else { } else {
let mut file = fs::File::open(path)?; 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| { 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 FinalError::with_title("Could not create archive")
.detail(format!("Unexpected error while trying to read file '{}'", to_utf(output_path))) .detail("Unexpected error while trying to read file")
.detail(format!("Error: {}.", err)) .detail(format!("Error: {}.", err))
.into_owned()
})?; })?;
} }
} }

View File

@ -205,3 +205,9 @@ impl From<oof::OofError> for Error {
Self::OofError(err) Self::OofError(err)
} }
} }
impl From<FinalError> for Error {
fn from(err: FinalError) -> Self {
Self::Custom { reason: err }
}
}