Skip to main content

journal_registry/repository/
error.rs

1use std::path::PathBuf;
2use thiserror::Error;
3
4/// Errors that can occur when working with a journal repository
5#[derive(Debug, Error)]
6pub enum RepositoryError {
7    /// I/O error when reading or scanning directories
8    #[error("I/O error: {0}")]
9    Io(#[from] std::io::Error),
10
11    /// Error when parsing a journal file path
12    #[error("Failed to parse journal file path: {path}")]
13    InvalidPath { path: String },
14
15    /// Error when a path contains invalid UTF-8
16    #[error("Path contains invalid UTF-8: {}", .path.display())]
17    InvalidUtf8 { path: PathBuf },
18
19    /// Error from walkdir when scanning directories
20    #[error("Directory walk error: {0}")]
21    WalkDir(#[from] walkdir::Error),
22}
23
24/// A specialized Result type for journal registry operations
25pub type Result<T> = std::result::Result<T, RepositoryError>;