1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use crate::discover::CrateInfoError;
use std::path::PathBuf;
use thiserror::Error;
/// Error types for analysis operations.
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum AnalysisError {
/// The specified module was not found in the crate.
#[error("Module not found: {module_path}")]
ModuleNotFound {
/// The module path that was not found.
module_path: String,
},
/// The crate root directory does not exist or is not a valid Rust project.
#[error("Invalid crate root: {path} - {reason}")]
InvalidCrateRoot {
/// The path that was provided.
path: PathBuf,
/// Description of what's wrong.
reason: String,
},
/// Errors related to crate metadata retrieval and validation.
#[error(transparent)]
CrateInfoError(#[from] CrateInfoError),
/// Error analyzing a specific module — includes module name and file for context.
#[error("Error analyzing module '{module_path}' (file '{file}'): {message}")]
ModuleAnalysisFailed {
/// The Rust module path being analyzed (e.g. `crate::parser::visitor`).
module_path: String,
/// The source file being parsed.
file: PathBuf,
/// Human-readable description of the parse or read error.
message: String,
},
}
/// Result type alias for analysis info operations.
pub(crate) type Result<T> = std::result::Result<T, AnalysisError>;