mod3d_gltf/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum GltfError {
5    #[error("IO error")]
6    Io(#[from] std::io::Error),
7    #[cfg(feature = "serde_json")]
8    #[error("Failed to parse GLTF Json")]
9    Json(#[from] serde_json::Error),
10    #[error("Bad GLTF Json")]
11    BadJson(String),
12    #[error("Bad UTF8 in GLTF Json")]
13    Utf8(#[from] std::str::Utf8Error),
14    #[error("Bad base64 in GLTF Json")]
15    Base64(#[from] base64::DecodeError),
16    #[error("Buffer shorter than specified byte_length")]
17    BufferTooShort,
18    #[error("Buffer could not be read")]
19    BufferRead,
20    #[error("Failed to load image {reason}")]
21    ImageLoad { reason: String },
22    #[error("Bad GLB header")]
23    GlbHdr,
24    #[error("Bad GLB Json header")]
25    GlbJsonHdr,
26    #[error("IO error reading GLB Json")]
27    GlbJsonIo(std::io::Error),
28    #[error("GLB json ends beyond file extent")]
29    GlbJsonLength,
30    #[error("Bad GLB binary buffer header")]
31    GlbBinHdr,
32    #[error("IO error reading GLB binary")]
33    GlbBinIo(std::io::Error),
34    #[error("unknown data store error")]
35    Unknown,
36}
37
38pub type Error = GltfError;
39pub type Result<T> = std::result::Result<T, Error>;