Skip to main content

occt_wasm/
error.rs

1//! Error types for the occt-wasm Rust crate.
2
3/// Errors that can occur when using the OCCT WASM kernel.
4#[derive(Debug, thiserror::Error)]
5pub enum OcctError {
6    /// An OCCT operation failed inside the WASM module.
7    #[error("{operation}: {message}")]
8    Operation {
9        /// The facade method that failed (e.g. `make_box`, `fuse`).
10        operation: String,
11        /// The error message from OCCT.
12        message: String,
13    },
14
15    /// The WASM runtime encountered an error.
16    #[error("WASM runtime error: {0}")]
17    Runtime(#[from] wasmtime::Error),
18
19    /// A memory access or data conversion error.
20    #[error("memory error: {0}")]
21    Memory(String),
22}
23
24/// Convenience alias for `Result<T, OcctError>`.
25pub type OcctResult<T> = Result<T, OcctError>;