1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum SensorLMError {
8 #[error("Shape mismatch: expected {expected:?}, got {actual:?}")]
10 ShapeMismatch {
11 expected: Vec<usize>,
13 actual: Vec<usize>,
15 },
16
17 #[error("Caption generation failed: {0}")]
19 CaptionError(String),
20
21 #[error("Dataset error: {0}")]
23 DatasetError(String),
24
25 #[error("Download failed for '{url}': {source}")]
27 DownloadError {
28 url: String,
30 #[source]
32 source: reqwest::Error,
33 },
34
35 #[error("I/O error: {0}")]
37 Io(#[from] std::io::Error),
38
39 #[error("JSON error: {0}")]
41 Json(#[from] serde_json::Error),
42
43 #[error("Tokeniser error: {0}")]
45 TokenizerError(String),
46
47 #[error("Quantisation error: {0}")]
49 QuantisationError(String),
50
51 #[error(transparent)]
53 Other(#[from] anyhow::Error),
54}
55
56pub type Result<T> = std::result::Result<T, SensorLMError>;