Improve creation of error messages

This commit is contained in:
2022-11-16 04:36:25 +01:00
parent 9cb04e2380
commit c638782fa8
2 changed files with 41 additions and 3 deletions

View File

@@ -2,7 +2,7 @@ use super::{*, SectorWriter, {CDDesc, Error}};
use super::super::types::{helper::{DirectoryRecordMember, PathTableMember}, layout::Layout, *};
use builder::SubModeBuilder;
use cdtypes::types::{cdstring::{AString, DString}, date::*, dir_record::*, helper::{round_bytes_mode2_form1, sector_count_mode2_form1}, path_table::*, pvd as cd_pvd, lsb_msb::*, sector::Mode2Form1};
use tool_helper::{BufferedInputFile, open_input_file_buffered};
use tool_helper::{BufferedInputFile, construct_from_error_if as format_if_error, open_input_file_buffered};
use std::io::{Read, Seek, SeekFrom};
const ROOT_DIR_NAME:&'static str = "\x00";
@@ -159,8 +159,8 @@ fn process_system_area(system_area: &SystemArea, sec_writer: &mut dyn SectorWrit
return Err(Error::from_text(format!("System Area required to start at sector 0 of Track - found LBA: {}", system_area_lba)));
}
if let Some(license_file) = &system_area.license_file_path {
let license_file = open_input_file_buffered(license_file)?;
if let Some(license_path) = &system_area.license_file_path {
let license_file = format_if_error!(open_input_file_buffered(license_path), "Loading license file from {} failed with: {error_text}", license_path.to_string_lossy())?;
write_license_file(sec_writer, license_file)
}