#![allow(dead_code)] use std::fmt; #[derive(Debug)] pub enum StoreError { DaemonConnectionFailed(String), OperationFailed(String), InvalidPath(String), PathNotFound(String), Io(std::io::Error), } impl fmt::Display for StoreError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { StoreError::DaemonConnectionFailed(msg) => { write!(f, "Failed to connect to nix-daemon: {}", msg) } StoreError::OperationFailed(msg) => write!(f, "Store operation failed: {}", msg), StoreError::InvalidPath(msg) => write!(f, "Invalid store path: {}", msg), StoreError::PathNotFound(path) => write!(f, "Path not found in store: {}", path), StoreError::Io(e) => write!(f, "I/O error: {}", e), } } } impl std::error::Error for StoreError {} impl From for StoreError { fn from(e: std::io::Error) -> Self { StoreError::Io(e) } }