1use thiserror::Error;
7
8#[derive(Debug, Clone, PartialEq, Eq, Error)]
13pub enum RangeError {
14 #[error("rational reconstruction failed: have {have_bits} bits of range, need more")]
15 ReconstructionFailed { have_bits: u64, need_more: bool },
16 #[error("value of {value_bits} bits exceeds basis capacity of {capacity_bits} bits")]
17 CapacityExceeded { value_bits: u64, capacity_bits: u64 },
18}
19
20#[derive(Debug, Clone, PartialEq, Eq, Error)]
22pub enum BasisError {
23 #[error("requested {requested_bits} bits but no further GPU-eligible primes are available")]
24 PrimesExhausted { requested_bits: u64 },
25 #[error("operands use different bases (len {a} vs {b})")]
26 Mismatch { a: usize, b: usize },
27}
28
29#[derive(Debug, Clone, PartialEq, Eq, Error)]
31#[error("channel/basis mismatch: {0} vs {1}")]
32pub struct ChannelMismatch(pub usize, pub usize);
33
34#[derive(Debug, Error)]
36pub enum GpuError {
37 #[error("no compatible GPU adapter found")]
38 NoAdapter,
39 #[error("failed to acquire GPU device: {0}")]
40 Device(#[from] wgpu::RequestDeviceError),
41}