1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::io;
use thiserror::Error;

/// Error type for thumbnail extraction.
#[derive(Error, Debug)]
pub enum ThumbnailerError {
    /// Couldn't open the file, either by missing permissions or the file not existing.
    #[error("Could not open file")]
    CouldntOpenFile(#[from] io::Error),
    /// Tried to read to an offset outside of the file. This probably means the file is corrupted
    /// or not from a supported format.
    #[error("Could not read data at offset `{0}`")]
    BoundError(u64),
    /// Wrong icon version. This may mean the file is corrupted or not from a supported format.
    #[error("Unsupported icon version, probably not an NDS file")]
    UnsupportedIcon,
    /// File name has no extension. We use the extension to determine which format we should
    /// decode.
    #[error("File has no extension")]
    NoExtension,
    /// File name has unsupported extension. We use the extension to determine which format we
    /// should decode.
    #[error("File has unsupported extension")]
    UnsupportedExtension,
}