* choose ESP matching the primary data disk when multiple ESPs exist, falling back gracefully for single-disk layouts * keep new helper to normalize device names and reuse the idempotent mount logic * apply cargo fmt across the tree
57 lines
1.6 KiB
Rust
57 lines
1.6 KiB
Rust
//! Common error types and result alias for zosstorage.
|
|
|
|
use thiserror::Error as ThisError;
|
|
|
|
/// Top-level error for zosstorage covering configuration, validation,
|
|
/// device discovery, partitioning, filesystem, mounting, reporting,
|
|
/// and external tool invocation failures.
|
|
#[derive(Debug, ThisError)]
|
|
pub enum Error {
|
|
/// Invalid or malformed configuration input.
|
|
#[error("configuration error: {0}")]
|
|
Config(String),
|
|
|
|
/// Semantic validation failure.
|
|
#[error("validation error: {0}")]
|
|
Validation(String),
|
|
|
|
/// Errors related to device discovery and probing.
|
|
#[error("device discovery error: {0}")]
|
|
Device(String),
|
|
|
|
/// Partitioning or GPT manipulation failures.
|
|
#[error("partitioning error: {0}")]
|
|
Partition(String),
|
|
|
|
/// Filesystem creation or probing failures.
|
|
#[error("filesystem error: {0}")]
|
|
Filesystem(String),
|
|
|
|
/// Mount operation failures.
|
|
#[error("mount error: {0}")]
|
|
Mount(String),
|
|
|
|
/// State report construction or write failures.
|
|
#[error("report error: {0}")]
|
|
Report(String),
|
|
|
|
/// External system tool invocation failure with captured stderr.
|
|
#[error("external tool '{tool}' failed with status {status}: {stderr}")]
|
|
Tool {
|
|
tool: String,
|
|
status: i32,
|
|
stderr: String,
|
|
},
|
|
|
|
/// Placeholder for not-yet-implemented functionality (e.g., --force).
|
|
#[error("unimplemented: {0}")]
|
|
Unimplemented(&'static str),
|
|
|
|
/// Any other error wrapped with context.
|
|
#[error(transparent)]
|
|
Other(#[from] anyhow::Error),
|
|
}
|
|
|
|
/// Crate-wide result alias.
|
|
pub type Result<T> = std::result::Result<T, Error>;
|