ricecoder_refactoring/
error.rs

1//! Error types for the refactoring engine
2
3use thiserror::Error;
4
5/// Result type for refactoring operations
6pub type Result<T> = std::result::Result<T, RefactoringError>;
7
8/// Errors that can occur during refactoring operations
9#[derive(Debug, Error)]
10pub enum RefactoringError {
11    /// Configuration error
12    #[error("Configuration error: {0}")]
13    ConfigError(String),
14
15    /// Invalid configuration
16    #[error("Invalid configuration: {0}")]
17    InvalidConfiguration(String),
18
19    /// Storage error
20    #[error("Storage error: {0}")]
21    StorageError(String),
22
23    /// Analysis failed
24    #[error("Analysis failed: {0}")]
25    AnalysisFailed(String),
26
27    /// Refactoring failed
28    #[error("Refactoring failed: {0}")]
29    RefactoringFailed(String),
30
31    /// Impact analysis failed
32    #[error("Impact analysis failed: {0}")]
33    ImpactAnalysisFailed(String),
34
35    /// Validation failed
36    #[error("Validation failed: {0}")]
37    ValidationFailed(String),
38
39    /// Rollback failed
40    #[error("Rollback failed: {0}")]
41    RollbackFailed(String),
42
43    /// File operation error
44    #[error("File operation error: {0}")]
45    FileError(String),
46
47    /// Pattern error
48    #[error("Pattern error: {0}")]
49    PatternError(String),
50
51    /// Provider error
52    #[error("Provider error: {0}")]
53    ProviderError(String),
54
55    /// LSP error
56    #[error("LSP error: {0}")]
57    LspError(String),
58
59    /// Other error
60    #[error("{0}")]
61    Other(String),
62
63    /// IO error
64    #[error("IO error: {0}")]
65    IoError(#[from] std::io::Error),
66
67    /// JSON error
68    #[error("JSON error: {0}")]
69    JsonError(#[from] serde_json::Error),
70
71    /// YAML error
72    #[error("YAML error: {0}")]
73    YamlError(#[from] serde_yaml::Error),
74}