use thiserror::Error;
use crate::{BackendId, Operation};
pub type GeomResult<T> = Result<T, GeomError>;
#[non_exhaustive]
#[derive(Debug, Clone, Error, PartialEq, Eq)]
pub enum GeomError {
#[error("invalid geometry input: {0}")]
InvalidInput(String),
#[error("backend `{backend}` does not support {operation:?}")]
Unsupported {
backend: BackendId,
operation: Operation,
},
#[error("backend `{backend}` cannot apply {operation:?} to `{input}`")]
UnsupportedInput {
backend: BackendId,
operation: Operation,
input: &'static str,
},
#[error("backend `{backend}` is unavailable: {reason}")]
Unavailable {
backend: BackendId,
reason: String,
},
#[error("backend `{backend}` violated its contract: {detail}")]
BackendContractViolation {
backend: BackendId,
detail: String,
},
#[error("input is not manifold: {0}")]
NotManifold(String),
#[error("numerically degenerate input: {0}")]
Degenerate(String),
#[error("operation exceeded its {resource} budget")]
BudgetExceeded {
resource: &'static str,
},
#[error("operation cancelled")]
Cancelled,
}