draco_io/gltf_error.rs
1//! Shared errors for glTF container, resource, and geometry operations.
2
3use std::io;
4
5use thiserror::Error;
6
7/// Errors that can occur when reading, transforming, or decoding glTF data.
8#[derive(Error, Debug)]
9pub enum GltfError {
10 /// Underlying stream or filesystem error.
11 #[error("IO error: {0}")]
12 Io(#[from] io::Error),
13 /// Malformed GLB header or chunk table.
14 #[error("Invalid GLB: {0}")]
15 InvalidGlb(String),
16 /// Malformed glTF structure or accessor data.
17 #[error("Invalid glTF: {0}")]
18 InvalidGltf(String),
19 /// Draco bitstream decoding failed.
20 #[error("Draco decode error: {0}")]
21 DracoDecode(#[source] draco_core::DracoError),
22 /// Draco bitstream encoding failed.
23 #[error("Draco encode error: {0}")]
24 DracoEncode(#[source] draco_core::DracoError),
25 /// The requested format operation is outside this crate's contract.
26 #[error("Unsupported feature: {0}")]
27 Unsupported(String),
28 /// An external resource was denied by the resolver policy.
29 #[error("External resource denied: {0}")]
30 ExternalResourceDenied(String),
31 /// A configured resource quota was exceeded.
32 #[error("Resource limit exceeded: {0}")]
33 ResourceLimitExceeded(String),
34 /// A binary reference could not be safely interpreted or remapped.
35 #[error("Opaque binary reference: {0}")]
36 OpaqueBinaryReference(String),
37 /// Caller-supplied compression options are invalid.
38 #[error("Invalid compression options: {0}")]
39 InvalidOptions(String),
40}
41
42/// Result type for low-level glTF container and geometry operations.
43pub type Result<T> = std::result::Result<T, GltfError>;