Skip to main content

journal_log_writer/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur during journal writing operations.
4#[derive(Error, Debug)]
5pub enum WriterError {
6    /// Failed to serialize value to journal entry format
7    #[error("serialization error: {0}")]
8    Serialization(String),
9
10    /// Attempted to write a journal entry without fields
11    #[error("journal entry has no fields")]
12    EmptyEntry,
13
14    /// Invalid path for journal directory
15    #[error("invalid path: {0}")]
16    InvalidPath(String),
17
18    /// Path is not a directory
19    #[error("not a directory: {0}")]
20    NotADirectory(String),
21
22    /// Failed to create journal file
23    #[error("failed to create journal file: {0}")]
24    FileCreation(String),
25
26    /// Machine ID could not be loaded or validated
27    #[error("machine ID error: {0}")]
28    MachineId(String),
29
30    /// Invalid high-level log writer configuration
31    #[error("invalid config: {0}")]
32    InvalidConfig(String),
33
34    /// I/O error when interacting with filesystem
35    #[error("I/O error: {0}")]
36    Io(#[from] std::io::Error),
37
38    /// Underlying journal file error
39    #[error("journal error: {0}")]
40    Journal(#[from] journal_core::error::JournalError),
41
42    /// Repository/registry error
43    #[error("registry error: {0}")]
44    Registry(#[from] journal_registry::RegistryError),
45}
46
47pub type Result<T> = std::result::Result<T, WriterError>;