1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum OverrideError {
6 #[error("Failed to parse source file: {0}")]
7 ParseError(String),
8
9 #[error("Function not found at position {line}:{column} in {file}")]
10 FunctionNotFound {
11 file: PathBuf,
12 line: usize,
13 column: usize,
14 },
15
16 #[error("Invalid override key: {0}")]
17 InvalidKey(String),
18
19 #[error("Override not found for key: {0}")]
20 OverrideNotFound(String),
21
22 #[error("Failed to read file: {0}")]
23 FileReadError(#[from] std::io::Error),
24
25 #[error("Serialization error: {0}")]
26 SerializationError(#[from] toml::ser::Error),
27
28 #[error("Deserialization error: {0}")]
29 DeserializationError(#[from] toml::de::Error),
30
31 #[error("Configuration error: {0}")]
32 ConfigError(#[from] raz_config::ConfigError),
33
34 #[error("Tree-sitter error: {0}")]
35 TreeSitterError(String),
36
37 #[error("Multiple functions found matching '{0}', please be more specific")]
38 AmbiguousFunction(String),
39
40 #[error("Storage error: {0}")]
41 StorageError(String),
42
43 #[error("Migration error: {0}")]
44 MigrationError(String),
45
46 #[error("Validation error: {0}")]
47 ValidationError(String),
48}
49
50pub type Result<T> = std::result::Result<T, OverrideError>;