1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, BitNetError>;
7
8#[derive(Debug, Error)]
10pub enum BitNetError {
11 #[error("invalid configuration: {0}")]
13 InvalidConfig(String),
14
15 #[error("shape mismatch: expected {expected:?}, got {actual:?}")]
17 ShapeMismatch {
18 expected: Vec<usize>,
20 actual: Vec<usize>,
22 },
23
24 #[error("dimension mismatch: expected {expected}, got {actual}")]
26 DimensionMismatch {
27 expected: usize,
29 actual: usize,
31 },
32
33 #[error("quantization error: {0}")]
35 Quantization(String),
36
37 #[error("tensor error: {0}")]
39 Tensor(#[from] candle_core::Error),
40
41 #[error("ternary error: {0}")]
43 Ternary(#[from] trit_vsa::TernaryError),
44
45 #[error("I/O error: {0}")]
47 Io(#[from] std::io::Error),
48
49 #[error("serialization error: {0}")]
51 Serialization(String),
52
53 #[error("feature not available: {0}")]
55 FeatureNotAvailable(String),
56}