Skip to main content

geo_polygonize_core/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum PolygonizeError {
5    #[error("Invalid argument type for {field}: expected {expected}, got {actual}")]
6    InvalidArgumentType {
7        field: String,
8        expected: String,
9        actual: String,
10    },
11
12    #[error("Invalid geometry: {reason}")]
13    InvalidGeometry { reason: String },
14
15    #[error("Invalid buffer shape: {reason}")]
16    InvalidBufferShape { reason: String },
17
18    #[error("Unsupported option combination: {reason}")]
19    UnsupportedOptionCombination { reason: String },
20
21    #[error("Topology failure: {reason}")]
22    TopologyFailure { reason: String },
23
24    #[error("Internal invariant violation: {reason}")]
25    InternalInvariantViolation { reason: String },
26
27    #[error("Arrow array conversion failed: {0}")]
28    ArrowError(String),
29
30    #[error("Null pointer provided to FFI function: {0}")]
31    NullPointer(String),
32
33    #[error("Panic occurred across FFI/WASM boundary: {0}")]
34    Panic(String),
35}
36
37pub type Result<T> = std::result::Result<T, PolygonizeError>;