Change error kind
This commit is contained in:
1 parent
945a02d1e1
commit
fc0dafcde2
3 files changed
+4
-2
No files matched your search
@@ -99,7 +99,7 @@ impl Image {
|
|||||||
let height = tag_reader.require_tag(Tag::ImageLength)?.into_u32()?;
|
let height = tag_reader.require_tag(Tag::ImageLength)?.into_u32()?;
|
||||||
if width == 0 || height == 0 {
|
if width == 0 || height == 0 {
|
||||||
return Err(TiffError::FormatError(
|
return Err(TiffError::FormatError(
|
||||||
TiffFormatError::InconsistentSizesEncountered,
|
TiffFormatError::InvalidDimensions(width, height),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -352,7 +352,7 @@ impl<'a, W: 'a + Write + Seek, T: ColorType, K: TiffKind, D: Compression>
|
|||||||
) -> TiffResult<Self> {
|
) -> TiffResult<Self> {
|
||||||
if width == 0 || height == 0 {
|
if width == 0 || height == 0 {
|
||||||
return Err(TiffError::FormatError(
|
return Err(TiffError::FormatError(
|
||||||
TiffFormatError::InconsistentSizesEncountered,
|
TiffFormatError::InvalidDimensions(width, height),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ pub enum TiffFormatError {
|
|||||||
actual_samples: usize,
|
actual_samples: usize,
|
||||||
required_samples: usize,
|
required_samples: usize,
|
||||||
},
|
},
|
||||||
|
InvalidDimensions(u32, u32),
|
||||||
InvalidTag,
|
InvalidTag,
|
||||||
InvalidTagValueType(Tag),
|
InvalidTagValueType(Tag),
|
||||||
RequiredTagNotFound(Tag),
|
RequiredTagNotFound(Tag),
|
||||||
@@ -100,6 +101,7 @@ impl fmt::Display for TiffFormatError {
|
|||||||
actual_samples, required_samples
|
actual_samples, required_samples
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
InvalidDimensions(width, height) => write!(fmt, "Invalid dimensions: {}x{}.", width, height),
|
||||||
InvalidTag => write!(fmt, "Image contains invalid tag."),
|
InvalidTag => write!(fmt, "Image contains invalid tag."),
|
||||||
InvalidTagValueType(ref tag) => {
|
InvalidTagValueType(ref tag) => {
|
||||||
write!(fmt, "Tag `{:?}` did not have the expected value type.", tag)
|
write!(fmt, "Tag `{:?}` did not have the expected value type.", tag)
|
||||||
|
|||||||
Reference in new issue
Block a user