Skip to main content

hadris_cd/
error.rs

1//! Error types for hadris-cd
2
3use hadris_io as io;
4
5/// Errors that can occur during CD/DVD image creation
6#[derive(Debug, thiserror::Error)]
7pub enum Error {
8    /// I/O error
9    #[error("I/O error: {0}")]
10    Io(#[from] io::Error),
11
12    /// ISO creation error
13    #[error("ISO error: {0}")]
14    Iso(#[from] hadris_iso::write::IsoCreationError),
15
16    /// UDF error
17    #[error("UDF error: {0}")]
18    Udf(#[from] hadris_udf::Error),
19
20    /// Invalid file path
21    #[error("Invalid file path: {0}")]
22    InvalidPath(String),
23
24    /// File not found in tree
25    #[error("File not found: {0}")]
26    FileNotFound(String),
27
28    /// Directory not found in tree
29    #[error("Directory not found: {0}")]
30    DirectoryNotFound(String),
31
32    /// Volume name too long
33    #[error("Volume name too long (max {max} characters): {name}")]
34    VolumeNameTooLong {
35        /// Rejected volume identifier.
36        name: String,
37        /// Maximum number of characters accepted by the selected formats.
38        max: usize,
39    },
40
41    /// Invalid configuration
42    #[error("Invalid configuration: {0}")]
43    InvalidConfig(String),
44}
45
46/// Result type for CD operations
47pub type Result<T> = core::result::Result<T, Error>;