rom_thumbnails/error.rs
1//! Errors for this library.
2//!
3//! Right now, only the [`ThumbnailerError`] type is exposed.
4//!
5//! [`ThumbnailerError`]: enum.ThumbnailerError.html
6use std::io;
7use thiserror::Error;
8
9/// Error type for thumbnail extraction.
10#[derive(Error, Debug)]
11pub enum ThumbnailerError {
12 /// Couldn't open the file, either by missing permissions or the file not existing.
13 #[error("Could not open file")]
14 CouldntOpenFile(#[from] io::Error),
15 /// Tried to read to an offset outside of the file. This probably means the file is corrupted
16 /// or not from a supported format.
17 #[error("Could not read data at offset `{0}`")]
18 BoundError(u64),
19 /// Wrong icon version. This may mean the file is corrupted or not from a supported format.
20 #[error("Unsupported icon version, probably not an NDS file")]
21 UnsupportedIcon,
22 /// File name has no extension. We use the extension to determine which format we should
23 /// decode.
24 #[error("File has no extension")]
25 NoExtension,
26 /// File name has unsupported extension. We use the extension to determine which format we
27 /// should decode.
28 #[error("File has unsupported extension")]
29 UnsupportedExtension,
30}