apt-ostree/src/error.rs

95 lines
No EOL
2.3 KiB
Rust

use thiserror::Error;
/// Unified error type for apt-ostree operations
#[derive(Error, Debug)]
pub enum AptOstreeError {
#[error("APT error: {0}")]
Apt(#[from] rust_apt::error::AptErrors),
#[error("Deployment failed: {0}")]
Deployment(String),
#[error("System initialization failed: {0}")]
Initialization(String),
#[error("Configuration error: {0}")]
Configuration(String),
#[error("Permission denied: {0}")]
PermissionDenied(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Serde JSON error: {0}")]
SerdeJson(#[from] serde_json::Error),
#[error("Invalid argument: {0}")]
InvalidArgument(String),
#[error("Operation cancelled by user")]
Cancelled,
#[error("System not initialized. Run 'apt-ostree init' first")]
NotInitialized,
#[error("Branch not found: {0}")]
BranchNotFound(String),
#[error("Package not found: {0}")]
PackageNotFound(String),
#[error("Dependency conflict: {0}")]
DependencyConflict(String),
#[error("Transaction failed: {0}")]
Transaction(String),
#[error("Rollback failed: {0}")]
Rollback(String),
#[error("Package operation failed: {0}")]
PackageOperation(String),
#[error("Script execution failed: {0}")]
ScriptExecution(String),
#[error("OSTree operation failed: {0}")]
OstreeOperation(String),
#[error("OSTree error: {0}")]
OstreeError(String),
#[error("DEB package parsing failed: {0}")]
DebParsing(String),
#[error("Filesystem assembly failed: {0}")]
FilesystemAssembly(String),
#[error("Database error: {0}")]
DatabaseError(String),
#[error("Sandbox error: {0}")]
SandboxError(String),
#[error("Unknown error: {0}")]
Unknown(String),
#[error("System error: {0}")]
SystemError(String),
#[error("APT error: {0}")]
AptError(String),
#[error("UTF-8 conversion error: {0}")]
FromUtf8(#[from] std::string::FromUtf8Error),
#[error("GLib error: {0}")]
Glib(#[from] ostree::glib::Error),
#[error("Regex error: {0}")]
Regex(#[from] regex::Error),
}
/// Result type for apt-ostree operations
pub type AptOstreeResult<T> = Result<T, AptOstreeError>;