ifc_lite_geometry/
error.rs

1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
5use thiserror::Error;
6
7/// Result type for geometry operations
8pub type Result<T> = std::result::Result<T, Error>;
9
10/// Errors that can occur during geometry processing
11#[derive(Error, Debug)]
12pub enum Error {
13    #[error("Triangulation failed: {0}")]
14    TriangulationError(String),
15
16    #[error("Invalid profile: {0}")]
17    InvalidProfile(String),
18
19    #[error("Invalid extrusion parameters: {0}")]
20    InvalidExtrusion(String),
21
22    #[error("Empty mesh: {0}")]
23    EmptyMesh(String),
24
25    #[error("Geometry processing error: {0}")]
26    GeometryError(String),
27
28    #[error("Core parser error: {0}")]
29    CoreError(#[from] ifc_lite_core::Error),
30}
31
32impl Error {
33    /// Create a geometry processing error
34    pub fn geometry(msg: impl Into<String>) -> Self {
35        Self::GeometryError(msg.into())
36    }
37}