Skip to main content

landmark_common/
error.rs

1/// Error for mesh I/O and structural validation
2#[derive(thiserror::Error, Debug)]
3pub enum MeshError {
4    #[error("OBJ parse error: {0}")]
5    ObjParse(String),
6
7    #[error("vertex array length {len} is not a multiple of 3")]
8    VertexArrayNotTripled { len: usize },
9
10    #[error("index array length {len} is not a multiple of 3")]
11    IndexArrayNotTripled { len: usize },
12
13    #[error("triangle index out of bounds: ({i0}, {i1}, {i2}), vertex count: {vertex_count}")]
14    TriangleIndexOutOfBounds {
15        i0: usize,
16        i1: usize,
17        i2: usize,
18        vertex_count: usize,
19    },
20
21    #[cfg(feature = "std")]
22    #[error(transparent)]
23    Io(#[from] std::io::Error),
24}