wow_blp/encode/
error.rs

1use crate::types::BlpVersion;
2use thiserror::Error;
3
4/// Errors that can occur during BLP encoding operations
5#[derive(Debug, Error)]
6pub enum Error {
7    /// Image width exceeds BLP format maximum of 65,535 pixels
8    #[error("BLP supports width up to 65,535, the width: {0}")]
9    WidthTooHigh(u32),
10    /// Image height exceeds BLP format maximum of 65,535 pixels
11    #[error("BLP supports height up to 65,535, the width: {0}")]
12    HeightTooHigh(u32),
13    /// The specified BLP version does not support external mipmap files
14    #[error("External mipmaps are not supported for the version {0}")]
15    ExternalMipmapsNotSupported(BlpVersion),
16    /// Mipmap data offset is invalid or out of bounds
17    #[error("Invalid offset {offset} for mipmap {mipmap}, filled bytes {filled}")]
18    InvalidOffset {
19        /// Index of the mipmap with invalid offset
20        mipmap: usize,
21        /// The invalid offset value
22        offset: usize,
23        /// Number of bytes already written
24        filled: usize,
25    },
26    /// Mipmap size in header doesn't match actual data size
27    #[error("Size of mipmap {mipmap} in header {in_header} doesn't match actual {actual}")]
28    InvalidMipmapSize {
29        /// Index of the mipmap with size mismatch
30        mipmap: usize,
31        /// Size declared in the header
32        in_header: usize,
33        /// Actual size of the mipmap data
34        actual: usize,
35    },
36    /// Filesystem operation failed
37    #[error("Failed to proceed {0}, due: {1}")]
38    FileSystem(std::path::PathBuf, std::io::Error),
39    /// Invalid or malformed file name for BLP file
40    #[error("Name of root file is malformed: {0}")]
41    FileNameInvalid(std::path::PathBuf),
42}