From de95ac35a2ef2972bc76d3f3e6d5e7ebe6c13934 Mon Sep 17 00:00:00 2001 From: Christopher Gundler Date: Wed, 22 Dec 2021 12:29:39 +0100 Subject: [PATCH] Remove "CompressionError" --- src/error.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/error.rs b/src/error.rs index 0f51891..45ea5b0 100644 --- a/src/error.rs +++ b/src/error.rs @@ -33,9 +33,6 @@ pub enum TiffError { /// The image does not support the requested operation UsageError(UsageError), - - /// An error has occurred during data compression - CompressionError, } /// The image is not formatted properly. @@ -233,7 +230,6 @@ impl fmt::Display for TiffError { TiffError::LimitsExceeded => write!(fmt, "The Decoder limits are exceeded"), TiffError::IntSizeError => write!(fmt, "Platform or format size limits exceeded"), TiffError::UsageError(ref e) => write!(fmt, "Usage error: {}", e), - TiffError::CompressionError => write!(fmt, "Compression failed"), } } } @@ -247,7 +243,6 @@ impl Error for TiffError { TiffError::LimitsExceeded => "Decoder limits exceeded", TiffError::IntSizeError => "Platform or format size limits exceeded", TiffError::UsageError(..) => "Invalid usage", - TiffError::CompressionError => "Compression failed", } } @@ -296,8 +291,12 @@ impl From for TiffError { } impl From for TiffError { - fn from(_err: LzwError) -> TiffError { - TiffError::CompressionError + fn from(err: LzwError) -> TiffError { + match err { + LzwError::InvalidCode => TiffError::FormatError(TiffFormatError::Format(String::from( + "LZW compressed data corrupted", + ))), + } } }