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
//! Texture based errors.

use thiserror::Error;

/// Errors that occur from textures.
#[derive(Error, Debug)]
pub enum TextureError {
    /// This error gets returned when you set the texture ID of an Appearance object higher than the
    /// actual frame count of the texture this object is holding.
    #[error("The layer you set for this object does not exist:\n{0}")]
    Layer(String),
    /// This error gets returned when a function gets called that requires an object to have a textured material
    /// but it does not have one.
    #[error(
        "The object you ran a function on that requires a textured material does not have one."
    )]
    NoTexture,
    /// This error gets returned when you give the wrong format to the texture when trying to create a
    /// new texture.
    #[error("The given format does not match with the bytes provided:\n{0}")]
    InvalidFormat(String),
    /// If the texture for some reason can not be made.
    #[error("There was an error loading this texture:\n{0}")]
    Other(anyhow::Error),
}