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}