use std::path::PathBuf;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum StorageError {
#[error("failed to enumerate block devices: {0}")]
EnumerationFailed(String),
#[error("partitioning failed on {device}: {error}")]
PartitioningFailed { device: PathBuf, error: String },
#[error("format failed on {device}: {error}")]
FormatFailed { device: PathBuf, error: String },
#[error("mount failed: {from} -> {target}: {error}")]
MountFailed {
from: PathBuf,
target: PathBuf,
error: String,
},
#[error("subvolume creation failed at {path}: {error}")]
SubvolumeFailed { path: String, error: String },
#[error("command failed: {cmd}: {error}")]
CommandFailed { cmd: String, error: String },
#[error("device {0} is in use")]
DeviceInUse(PathBuf),
#[error("device {0} has existing data, refusing to initialize")]
DeviceNotEmpty(PathBuf),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
}