1use std::path::PathBuf;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
8pub enum EngineError {
9 #[error("I/O error: {0}")]
11 Io(#[from] std::io::Error),
12
13 #[error("Journal error: {0}")]
15 Journal(#[from] journal_core::JournalError),
16
17 #[error("Index error: {0}")]
19 Index(#[from] journal_index::IndexError),
20
21 #[error("Repository error: {0}")]
23 Repository(#[from] journal_registry::repository::RepositoryError),
24
25 #[error("Registry error: {0}")]
27 Registry(#[from] journal_registry::RegistryError),
28
29 #[error("Failed to parse journal file path: {path}")]
31 InvalidPath { path: String },
32
33 #[error("Path contains invalid UTF-8: {}", .path.display())]
35 InvalidUtf8 { path: PathBuf },
36
37 #[error("Channel closed")]
39 ChannelClosed,
40
41 #[error("Cache error: {0}")]
43 Foyer(#[from] foyer::Error),
44
45 #[error("Foyer IO error: {0}")]
47 FoyerIo(#[from] foyer::IoError),
48
49 #[error("Operation cancelled")]
51 Cancelled,
52
53 #[error("Invalid time range: start={start} >= end={end}")]
55 InvalidTimeRange { start: u32, end: u32 },
56}
57
58static_assertions::const_assert!(std::mem::size_of::<EngineError>() <= 64);
59
60pub type Result<T> = std::result::Result<T, EngineError>;