clean up
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#![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<std::io::Error> for StoreError {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
StoreError::Io(e)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user