pub mod encryption;
pub mod gitref;
pub mod keystore;
pub mod store;
#[derive(Debug, thiserror::Error)]
pub enum SyncError {
#[error("Encryption error: {0}")]
Encryption(String),
#[error("Key storage error: {0}")]
KeyStorage(String),
#[error("Serialization error: {0}")]
Serialization(String),
#[error("Compression error: {0}")]
Compression(String),
#[error("Git command failed: {0}")]
Git(String),
#[error("Ref update rejected (concurrent change): {0}")]
RefCasMismatch(String),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_sync_error_display_encryption() {
let err = SyncError::Encryption("bad key".to_string());
assert!(err.to_string().contains("bad key"));
}
#[test]
fn test_sync_error_display_git() {
let err = SyncError::Git("not a repository".to_string());
assert!(err.to_string().contains("not a repository"));
}
#[test]
fn test_sync_error_from_io() {
let io_err = std::io::Error::new(std::io::ErrorKind::NotFound, "missing");
let err: SyncError = io_err.into();
assert!(matches!(err, SyncError::Io(_)));
}
}