mod containers; mod images; mod cmd; mod example; use std::fmt; use std::error::Error; use std::io; /// Error type for buildah operations #[derive(Debug)] pub enum BuildahError { /// The buildah command failed to execute CommandExecutionFailed(io::Error), /// The buildah command executed but returned an error CommandFailed(String), /// Failed to parse JSON output JsonParseError(String), /// Failed to convert data ConversionError(String), /// Generic error Other(String), } impl fmt::Display for BuildahError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { BuildahError::CommandExecutionFailed(e) => write!(f, "Failed to execute buildah command: {}", e), BuildahError::CommandFailed(e) => write!(f, "Buildah command failed: {}", e), BuildahError::JsonParseError(e) => write!(f, "Failed to parse JSON: {}", e), BuildahError::ConversionError(e) => write!(f, "Conversion error: {}", e), BuildahError::Other(e) => write!(f, "{}", e), } } } impl Error for BuildahError { fn source(&self) -> Option<&(dyn Error + 'static)> { match self { BuildahError::CommandExecutionFailed(e) => Some(e), _ => None, } } } pub use containers::*; pub use images::*; pub use cmd::*; pub use example::*;