gltforge_unity/error/
mod.rs1use error_location::ErrorLocation;
2use gltforge::schema::{AccessorComponentType, MeshPrimitiveMode};
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum ConvertError {
7 #[error("no nodes in document {location}")]
8 NoNodes { location: ErrorLocation },
9
10 #[error("node index {index} out of range {location}")]
11 NodeIndexOutOfRange {
12 index: usize,
13 location: ErrorLocation,
14 },
15
16 #[error("node {index} has no mesh {location}")]
17 NodeHasNoMesh {
18 index: usize,
19 location: ErrorLocation,
20 },
21
22 #[error("no meshes in document {location}")]
23 NoMeshes { location: ErrorLocation },
24
25 #[error("mesh index {index} out of range {location}")]
26 MeshIndexOutOfRange {
27 index: usize,
28 location: ErrorLocation,
29 },
30
31 #[error("unsupported primitive mode {mode:?} {location}")]
32 UnsupportedPrimitiveMode {
33 mode: MeshPrimitiveMode,
34 location: ErrorLocation,
35 },
36
37 #[error("no POSITION attribute on primitive {location}")]
38 NoPositionAttribute { location: ErrorLocation },
39
40 #[error("POSITION accessor index out of range {location}")]
41 PositionAccessorOutOfRange { location: ErrorLocation },
42
43 #[error("POSITION accessor must be VEC3 FLOAT {location}")]
44 InvalidPositionType { location: ErrorLocation },
45
46 #[error("primitive has no index accessor {location}")]
47 NoIndices { location: ErrorLocation },
48
49 #[error("index accessor index out of range {location}")]
50 IndexAccessorOutOfRange { location: ErrorLocation },
51
52 #[error("unsupported index component type {component_type:?} {location}")]
53 UnsupportedIndexComponentType {
54 component_type: AccessorComponentType,
55 location: ErrorLocation,
56 },
57
58 #[error("accessor resolution failed: {source} {location}")]
59 Resolve {
60 #[source]
61 source: gltforge::error::ParseError,
62 location: ErrorLocation,
63 },
64}
65
66pub type ConvertResult<T> = std::result::Result<T, ConvertError>;