Skip to main content

guts_migrate/
error.rs

1//! Error types for migration operations.
2
3use thiserror::Error;
4
5/// Migration-specific errors.
6#[derive(Debug, Error)]
7pub enum MigrationError {
8    /// Failed to authenticate with source platform.
9    #[error("Authentication failed: {0}")]
10    AuthenticationFailed(String),
11
12    /// Repository not found on source platform.
13    #[error("Repository not found: {0}")]
14    RepositoryNotFound(String),
15
16    /// Failed to clone repository.
17    #[error("Git clone failed: {0}")]
18    GitCloneFailed(String),
19
20    /// Failed to push to Guts.
21    #[error("Git push failed: {0}")]
22    GitPushFailed(String),
23
24    /// API request failed.
25    #[error("API request failed: {0}")]
26    ApiError(String),
27
28    /// Rate limit exceeded.
29    #[error("Rate limit exceeded, retry after {0} seconds")]
30    RateLimitExceeded(u64),
31
32    /// Network error.
33    #[error("Network error: {0}")]
34    NetworkError(String),
35
36    /// Invalid configuration.
37    #[error("Invalid configuration: {0}")]
38    InvalidConfig(String),
39
40    /// Verification failed.
41    #[error("Verification failed: {0}")]
42    VerificationFailed(String),
43
44    /// Unsupported feature.
45    #[error("Unsupported feature: {0}")]
46    UnsupportedFeature(String),
47
48    /// Generic I/O error.
49    #[error("I/O error: {0}")]
50    IoError(#[from] std::io::Error),
51
52    /// JSON parsing error.
53    #[error("JSON parsing error: {0}")]
54    JsonError(#[from] serde_json::Error),
55
56    /// HTTP client error.
57    #[error("HTTP error: {0}")]
58    HttpError(#[from] reqwest::Error),
59}
60
61/// Result type for migration operations.
62pub type Result<T> = std::result::Result<T, MigrationError>;