apng/
errors.rs

1use std::io::Error as IOError;
2use thiserror::Error as ThisError;
3
4pub type APNGResult<T> = Result<T, APNGError>;
5
6#[derive(ThisError, Debug)]
7pub enum APNGError {
8    #[error("IO error: {0}")]
9    Io(#[from] IOError),
10    #[error("images are not found")]
11    ImagesNotFound,
12    #[error("wrong data size, expected {0} got {1}")]
13    WrongDataSize(usize, usize),
14    #[error("wrong frames nums, expected {0} got {1}")]
15    WrongFrameNums(usize, usize),
16}
17
18pub type AppResult<T> = Result<T, AppError>;
19
20#[derive(ThisError, Debug)]
21pub enum AppError {
22    #[error("png decode error: {0}")]
23    PNGImage(png::DecodingError),
24    #[error("Unsupported image")]
25    UnsupportedImage,
26}