1use sqlparser::parser::ParserError;
2
3#[derive(Debug, thiserror::Error)]
5pub enum QuerySyntaxError {
6 #[error("deserialization error: {0}")]
8 DeserializationError(String),
9 #[error("unsupported error: {0}")]
11 Unsupported(String),
12 #[error("sql parsing error: {0}")]
14 SQLParsingError(#[from] ParserError),
15 #[error("invalid sql error: {0}")]
17 InvalidSQL(String),
18
19 #[error("no query items error: {0}")]
21 NoQueryItems(&'static str),
22 #[error("contract not found error: {0}")]
24 DataContractNotFound(&'static str),
25 #[error("document type not found error: {0}")]
27 DocumentTypeNotFound(&'static str),
28
29 #[error("duplicate non groupable clause on same field error: {0}")]
31 DuplicateNonGroupableClauseSameField(&'static str),
32 #[error("multiple in clauses error: {0}")]
34 MultipleInClauses(&'static str),
35 #[error("multiple range clauses error: {0}")]
37 MultipleRangeClauses(&'static str),
38 #[error("range clauses not groupable error: {0}")]
40 RangeClausesNotGroupable(&'static str),
41
42 #[error("invalid BETWEEN clause error: {0}")]
44 InvalidBetweenClause(&'static str),
45 #[error("invalid IN clause error: {0}")]
47 InvalidInClause(String),
48 #[error("invalid STARTSWITH clause error: {0}")]
50 InvalidStartsWithClause(&'static str),
51
52 #[error("invalid where clause order error: {0}")]
54 InvalidWhereClauseOrder(&'static str),
55 #[error("invalid where clause components error: {0}")]
57 InvalidWhereClauseComponents(&'static str),
58
59 #[error("invalid order by properties error: {0}")]
61 InvalidOrderByProperties(&'static str),
62 #[error("invalid order by properties order error: {0}")]
64 InvalidOrderByPropertiesOrder(&'static str),
65
66 #[error("invalid contract id error: {0}")]
68 InvalidContractId(&'static str),
69 #[error("query invalid key parameter error: {0}")]
71 InvalidKeyParameter(String),
72 #[error("query invalid limit error: {0}")]
74 InvalidLimit(String),
75 #[error("query invalid parameter error: {0}")]
77 InvalidParameter(String),
78 #[error("query invalid format for where clause error: {0}")]
80 InvalidFormatWhereClause(&'static str),
81
82 #[error("conflicting conditions error: {0}")]
84 ConflictingConditions(&'static str),
85
86 #[error("duplicate start conditions error: {0}")]
88 DuplicateStartConditions(&'static str),
89 #[error("start document not found error: {0}")]
91 StartDocumentNotFound(&'static str),
92
93 #[error("invalid document type error: {0}")]
95 InvalidDocumentType(&'static str),
96
97 #[error("where clause on non indexed property error: {0}")]
99 WhereClauseOnNonIndexedProperty(String),
100 #[error("query is too far from index: {0}")]
102 QueryTooFarFromIndex(&'static str),
103 #[error("query on document type with no indexes: {0}")]
105 QueryOnDocumentTypeWithNoIndexes(&'static str),
106
107 #[error("missing order by for range error: {0}")]
109 MissingOrderByForRange(&'static str),
110
111 #[error("range operator not in final index error: {0}")]
113 RangeOperatorNotInFinalIndex(&'static str),
114 #[error("in operator not in final indexes error: {0}")]
116 InOperatorNotInFinalIndexesIndex(&'static str),
117 #[error("range operator does not have order by error: {0}")]
119 RangeOperatorDoesNotHaveOrderBy(&'static str),
120
121 #[error("validation error: {0}")]
123 Validation(&'static str),
124 #[error("where condition properties number error: {0}")]
126 WhereConditionPropertiesNumber(&'static str),
127
128 #[error("starts with illegal string error: {0}")]
130 StartsWithIllegalString(&'static str),
131
132 #[error("invalid identity prove request error: {0}")]
134 InvalidIdentityProveRequest(&'static str),
135
136 #[error("requesting proof with offset error: {0}")]
138 RequestingProofWithOffset(String),
139
140 #[error("unknown error: {0}")]
142 UnknownIndex(String),
143
144 #[error("incorrect index values error: {0}")]
146 IndexValuesError(String),
147}