|
|
|
@ -17,6 +17,7 @@ pub enum ThumbError {
|
|
|
|
|
|
|
|
|
|
NullVideo,
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "ffmpeg")]
|
|
|
|
|
FFMPEG(ffmpeg_next::Error),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -28,6 +29,8 @@ impl Display for ThumbError {
|
|
|
|
|
ThumbError::Decode => write!(f, "failed to decode image"),
|
|
|
|
|
ThumbError::Unsupported(mime) => write!(f, "Unsupported media type {}", mime),
|
|
|
|
|
ThumbError::NullVideo => write!(f, "no video data found in file"),
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "ffmpeg")]
|
|
|
|
|
ThumbError::FFMPEG(e) => write!(f, "ffmpeg error: {}", e),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -38,7 +41,10 @@ impl std::error::Error for ThumbError {
|
|
|
|
|
match self {
|
|
|
|
|
ThumbError::IO(e) => e.source(),
|
|
|
|
|
ThumbError::Image(i) => i.source(),
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "ffmpeg")]
|
|
|
|
|
ThumbError::FFMPEG(e) => e.source(),
|
|
|
|
|
|
|
|
|
|
_ => None,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -56,6 +62,7 @@ impl From<image::error::ImageError> for ThumbError {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "ffmpeg")]
|
|
|
|
|
impl From<ffmpeg_next::Error> for ThumbError {
|
|
|
|
|
fn from(e: ffmpeg_next::Error) -> Self {
|
|
|
|
|
Self::FFMPEG(e)
|
|
|
|
|