sdivi_core/error.rs
1use thiserror::Error;
2
3/// Errors produced by the sdivi-core pure-compute API.
4#[derive(Debug, Error)]
5#[non_exhaustive]
6pub enum AnalysisError {
7 /// I/O error (only reachable when the caller bridges to sdivi-pipeline).
8 #[error("I/O error: {0}")]
9 Io(#[from] std::io::Error),
10
11 /// No tree-sitter grammar was found for any language detected in the
12 /// repository. Analysis cannot proceed.
13 #[error("no grammar available for any detected language in the repository")]
14 NoGrammarsAvailable,
15
16 /// Configuration error surfaced from within the pipeline.
17 #[error("configuration error: {0}")]
18 Config(#[from] sdivi_config::ConfigError),
19
20 /// I/O error while writing a snapshot file or persisting the partition cache.
21 #[error("snapshot write error: {0}")]
22 SnapshotIo(std::io::Error),
23
24 /// A node ID failed the canonicalization rules.
25 ///
26 /// See [`crate::input::validate_node_id`] for the full set of rules.
27 #[error("invalid node id {id:?}: {reason}")]
28 InvalidNodeId {
29 /// The offending node ID string.
30 id: String,
31 /// Human-readable reason.
32 reason: String,
33 },
34
35 /// A configuration value is invalid.
36 #[error("invalid configuration: {message}")]
37 InvalidConfig {
38 /// Human-readable description of the problem.
39 message: String,
40 },
41}