Skip to main content

lora_analyzer/
errors.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum SemanticError {
5    #[error("Unknown variable `{0}`")]
6    UnknownVariable(String),
7
8    #[error("Duplicate variable `{0}` in the same scope")]
9    DuplicateVariable(String),
10
11    #[error("Unknown label `:{0}`")]
12    UnknownLabel(String),
13
14    #[error("Unknown relationship type `:{0}`")]
15    UnknownRelationshipType(String),
16
17    #[error("Unknown property `{0}`")]
18    UnknownProperty(String),
19
20    #[error("Unknown property `{0}` at {1}..{2}")]
21    UnknownPropertyAt(String, usize, usize),
22
23    #[error("Type mismatch in expression")]
24    TypeMismatch,
25
26    #[error("Invalid aggregation usage")]
27    InvalidAggregation,
28
29    #[error("Duplicate map key `{0}`")]
30    DuplicateMapKey(String),
31
32    #[error("Duplicate projection alias `{0}`")]
33    DuplicateProjectionAlias(String),
34
35    #[error("Expected a property map but found another expression at {0}..{1}")]
36    ExpectedPropertyMap(usize, usize),
37
38    #[error("Invalid relationship length range {0}..{1} at {2}..{3}")]
39    InvalidRange(u64, u64, usize, usize),
40
41    #[error("Unknown function `{0}` at {1}..{2}")]
42    UnknownFunction(String, usize, usize),
43
44    #[error("Wrong number of arguments for `{0}`: expected {1}, got {2}")]
45    WrongArity(String, String, usize),
46
47    #[error("Aggregation functions are not allowed in WHERE clause")]
48    AggregationInWhere,
49
50    #[error("All UNION branches must return the same number of columns: expected {0}, got {1}")]
51    UnionColumnCountMismatch(usize, usize),
52
53    #[error("All UNION branches must return the same column names: expected `{0}`, got `{1}`")]
54    UnionColumnNameMismatch(String, String),
55
56    #[error("Unsupported feature: {0}")]
57    UnsupportedFeature(String),
58}