zinit 0.3.6

Process supervisor with dependency management
Documentation
//! Error types for MOS storage initialization

use std::path::PathBuf;
use thiserror::Error;

/// Errors during storage initialization
#[derive(Debug, Error)]
pub enum StorageError {
    /// Failed to enumerate block devices
    #[error("failed to enumerate block devices: {0}")]
    EnumerationFailed(String),

    /// Partitioning failed
    #[error("partitioning failed on {device}: {error}")]
    PartitioningFailed { device: PathBuf, error: String },

    /// Filesystem creation failed
    #[error("format failed on {device}: {error}")]
    FormatFailed { device: PathBuf, error: String },

    /// Mount failed
    #[error("mount failed: {from} -> {target}: {error}")]
    MountFailed {
        from: PathBuf,
        target: PathBuf,
        error: String,
    },

    /// Subvolume creation failed
    #[error("subvolume creation failed at {path}: {error}")]
    SubvolumeFailed { path: String, error: String },

    /// Command execution failed
    #[error("command failed: {cmd}: {error}")]
    CommandFailed { cmd: String, error: String },

    /// Device is in use
    #[error("device {0} is in use")]
    DeviceInUse(PathBuf),

    /// Device has existing data
    #[error("device {0} has existing data, refusing to initialize")]
    DeviceNotEmpty(PathBuf),

    /// IO error
    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),
}