Use improved error message generation
This commit is contained in:
parent
c638782fa8
commit
66b0f4814d
|
@ -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, construct_from_error_if as format_if_error, open_input_file_buffered};
|
||||
use tool_helper::{BufferedInputFile, format_if_error, open_input_file_buffered};
|
||||
use std::io::{Read, Seek, SeekFrom};
|
||||
|
||||
const ROOT_DIR_NAME:&'static str = "\x00";
|
||||
|
@ -148,10 +148,12 @@ fn process_system_area(system_area: &SystemArea, sec_writer: &mut dyn SectorWrit
|
|||
Ok(())
|
||||
}
|
||||
|
||||
write_data_zeros(sec_writer)?;
|
||||
write_license_string(sec_writer, &mut license_file)?;
|
||||
write_license_logo(sec_writer, &mut license_file)?;
|
||||
write_audio_zeros(sec_writer)
|
||||
format_if_error!(write_data_zeros(sec_writer), "Writing license data zeros failed with: {error_text}")?;
|
||||
format_if_error!(write_license_string(sec_writer, &mut license_file), "Writing license string from file failed with: {error_text}")?;
|
||||
format_if_error!(write_license_logo(sec_writer, &mut license_file), "Writing license logo from file failed with: {error_text}")?;
|
||||
format_if_error!(write_audio_zeros(sec_writer), "Writing license audio zeros failed with: {error_text}")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
let system_area_lba = system_area.track_rel_lba;
|
||||
|
|
|
@ -8,7 +8,7 @@ pub type Output = Box<dyn Write>;
|
|||
pub type Input = Box<dyn Read>;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! construct_from_error_if {
|
||||
macro_rules! format_if_error {
|
||||
($result:expr, $format_text:literal) => {
|
||||
tool_helper::callback_if_error($result, |error_text| {
|
||||
format!($format_text, error_text=error_text)
|
||||
|
|
Loading…
Reference in New Issue