1use ::image::error::ImageError;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
6pub enum Error {
7 #[error("There is no image in the BLP mipmaps level {0}!")]
9 MissingImage(usize),
10 #[error("Convertation error: {0}")]
12 Convert(#[from] ImageError),
13 #[error("Maximum value for width is 65,535")]
15 WidthTooLarge(u32),
16 #[error("Maximum value for height is 65,535")]
18 HeightTooLarge(u32),
19 #[error(
21 "Header sizes for mipmap {0} are {1}x{2}, but there are {3} pixels actually in content."
22 )]
23 MismatchSizes(usize, u32, u32, usize),
24 #[error(
26 "Header sizes for mipmap {0} are {1}x{2}, but there are {3} alpha values actually in content."
27 )]
28 MismatchAlphaSizes(usize, u32, u32, usize),
29 #[error("There are invalid alpha bits for the Raw1 format. Got {0}, expected: 0, 1, 4, 8.")]
31 Raw1InvalidAlphaBits(u32),
32 #[error("Color map length {0}, 256 expected!")]
34 ColorMapLengthInvalid(usize),
35 #[error("Expected palette of 256 colors, but got {0}")]
37 PaletteWrongSize(usize),
38 #[error("Failed to process bytes from DXT1 decomporession")]
40 Dxt1RawConvertFail,
41}