use thiserror::Error;
use crate::types::SnapshotId;
#[derive(Debug, Error)]
pub enum VcsError {
#[error("hash mismatch: expected {expected}, actual {actual}")]
HashMismatch {
expected: SnapshotId,
actual: SnapshotId,
},
#[error("uncommitted changes: {count} entities/edges modified since last commit")]
UncommittedChanges { count: usize },
#[error("invalid snapshot id: {0}")]
InvalidSnapshotId(String),
#[error("invalid branch name: {0:?}")]
InvalidBranchName(String),
#[error("invalid remote name {0:?}: must be one path segment [A-Za-z0-9._-]+ and not . or ..")]
InvalidRemoteName(String),
#[error("storage: {0}")]
Storage(String),
#[error("json: {0}")]
Json(#[from] serde_json::Error),
#[error("io: {0}")]
Io(#[from] std::io::Error),
#[error("internal: {0}")]
Internal(String),
}
impl From<khive_runtime::error::RuntimeError> for VcsError {
fn from(e: khive_runtime::error::RuntimeError) -> Self {
VcsError::Storage(e.to_string())
}
}