issun_analyzer/
error.rs

1//! Error types for the analyzer
2
3use thiserror::Error;
4
5/// Result type for analyzer operations
6pub type Result<T> = std::result::Result<T, AnalyzerError>;
7
8/// Errors that can occur during analysis
9#[derive(Error, Debug)]
10pub enum AnalyzerError {
11    /// Failed to read a file
12    #[error("Failed to read file: {path}")]
13    FileReadError {
14        path: String,
15        #[source]
16        source: std::io::Error,
17    },
18
19    /// Failed to write a file
20    #[error("Failed to write file: {path}")]
21    FileWriteError {
22        path: String,
23        #[source]
24        source: std::io::Error,
25    },
26
27    /// Failed to parse Rust code
28    #[error("Failed to parse Rust code in {path}")]
29    ParseError {
30        path: String,
31        #[source]
32        source: syn::Error,
33    },
34
35    /// Failed to serialize analysis result
36    #[error("Failed to serialize result")]
37    SerializationError(#[from] serde_json::Error),
38
39    /// Invalid input or configuration
40    #[error("Invalid input: {0}")]
41    InvalidInput(String),
42}