Include the container in the Error::NotFound message.

This commit is contained in:
KAMADA Ken'ichi 2020-01-26 19:21:18 +09:00
parent eec3791e10
commit 1d683572be
3 changed files with 4 additions and 4 deletions

View File

@ -61,7 +61,7 @@ impl fmt::Display for Error {
match *self {
Error::InvalidFormat(msg) => f.write_str(msg),
Error::Io(ref err) => err.fmt(f),
Error::NotFound(msg) => f.write_str(msg),
Error::NotFound(ctn) => write!(f, "No Exif data found in {}", ctn),
Error::BlankValue(msg) => f.write_str(msg),
Error::TooBig(msg) => f.write_str(msg),
Error::NotSupported(msg) => f.write_str(msg),

View File

@ -124,7 +124,7 @@ impl<R> Parser<R> where R: io::BufRead + io::Seek {
_ => self.skip_file_level_box(size)?,
}
}
Err(Error::NotFound("No Exif data found"))
Err(Error::NotFound("HEIF"))
}
// Reads size, type, and largesize,
@ -201,7 +201,7 @@ impl<R> Parser<R> where R: io::BufRead + io::Seek {
}
}
self.item_id.ok_or(Error::NotFound("No Exif data found"))?;
self.item_id.ok_or(Error::NotFound("HEIF"))?;
self.parse_iloc(iloc.ok_or("No ItemLocationBox")?)?;
let location = self.item_location.as_ref()
.ok_or("No matching item in ItemLocationBox")?;

View File

@ -81,7 +81,7 @@ fn get_exif_attr_sub<R>(reader: &mut R)
match code {
marker::Z | marker::TEM | marker::RST0..=marker::RST7 => continue,
marker::SOI => return Err(Error::InvalidFormat("Unexpected SOI")),
marker::EOI => return Err(Error::NotFound("No Exif data found")),
marker::EOI => return Err(Error::NotFound("JPEG")),
_ => {},
}
// Read marker segments.