chronix_engine/objstore/
error.rs1use thiserror::Error;
4
5#[derive(Debug, Error)]
7#[non_exhaustive]
8pub enum ObjStoreError {
9 #[error("object store error: {0}")]
11 Store(#[from] object_store::Error),
12
13 #[error("archive {object}: expected {expected} bytes, found {}", .found.map_or_else(|| "no object".to_string(), |n| n.to_string()))]
18 IntegrityCheckFailed {
19 object: String,
21 expected: usize,
23 found: Option<usize>,
25 },
26
27 #[error("cache I/O error: {0}")]
29 CacheIo(#[source] std::io::Error),
30
31 #[error("object not found: {path}")]
33 NotFound {
34 path: String,
36 },
37
38 #[error("invalid configuration: {detail}")]
40 InvalidConfig {
41 detail: String,
43 },
44
45 #[error("invalid URL: {0}")]
47 InvalidUrl(#[from] url::ParseError),
48
49 #[error("storage error: {0}")]
51 Storage(#[from] crate::storage::StorageError),
52
53 #[error("segment error: {0}")]
55 Segment(#[source] crate::segment::SegmentError),
56
57 #[error("parquet error: {0}")]
59 Parquet(String),
60
61 #[error("I/O error: {0}")]
63 Io(#[source] std::io::Error),
64}
65
66pub type Result<T> = std::result::Result<T, ObjStoreError>;
68
69impl From<ObjStoreError> for crate::storage::StorageError {
70 fn from(e: ObjStoreError) -> Self {
71 match e {
72 ObjStoreError::NotFound { path } => crate::storage::StorageError::NotFound {
73 path: std::path::PathBuf::from(path),
74 },
75 other => crate::storage::StorageError::InvalidPath {
76 detail: other.to_string(),
77 },
78 }
79 }
80}