schematic_mesher/
error.rs

1//! Error types for the schematic mesher.
2
3use thiserror::Error;
4
5/// Result type alias using MesherError.
6pub type Result<T> = std::result::Result<T, MesherError>;
7
8/// Main error type for schematic meshing operations.
9#[derive(Error, Debug)]
10pub enum MesherError {
11    /// Failed to read or parse a ZIP archive.
12    #[error("ZIP error: {0}")]
13    Zip(#[from] zip::result::ZipError),
14
15    /// Failed to parse JSON data.
16    #[error("JSON parse error: {0}")]
17    Json(#[from] serde_json::Error),
18
19    /// Failed to read or process an image.
20    #[error("Image error: {0}")]
21    Image(#[from] image::ImageError),
22
23    /// I/O error during file operations.
24    #[error("I/O error: {0}")]
25    Io(#[from] std::io::Error),
26
27    /// Resource not found in the resource pack.
28    #[error("Resource not found: {0}")]
29    ResourceNotFound(String),
30
31    /// Invalid resource pack structure.
32    #[error("Invalid resource pack: {0}")]
33    InvalidResourcePack(String),
34
35    /// Failed to resolve a block model.
36    #[error("Model resolution error: {0}")]
37    ModelResolution(String),
38
39    /// Failed to resolve a blockstate.
40    #[error("Blockstate resolution error: {0}")]
41    BlockstateResolution(String),
42
43    /// Texture reference could not be resolved.
44    #[error("Unresolved texture reference: {0}")]
45    UnresolvedTexture(String),
46
47    /// Model inheritance chain too deep (circular reference protection).
48    #[error("Model inheritance too deep (possible circular reference): {0}")]
49    ModelInheritanceTooDeep(String),
50
51    /// Failed to build texture atlas.
52    #[error("Atlas building error: {0}")]
53    AtlasBuild(String),
54
55    /// Failed to export mesh.
56    #[error("Export error: {0}")]
57    Export(String),
58}