drive/error/
query.rs

1use sqlparser::parser::ParserError;
2
3/// Query errors
4#[derive(Debug, thiserror::Error)]
5pub enum QuerySyntaxError {
6    /// Deserialization
7    #[error("deserialization error: {0}")]
8    DeserializationError(String),
9    /// Unsupported error
10    #[error("unsupported error: {0}")]
11    Unsupported(String),
12    /// Invalid SQL error
13    #[error("sql parsing error: {0}")]
14    SQLParsingError(#[from] ParserError),
15    /// Invalid SQL error
16    #[error("invalid sql error: {0}")]
17    InvalidSQL(String),
18
19    /// We asked for nothing
20    #[error("no query items error: {0}")]
21    NoQueryItems(&'static str),
22    ///DataContract not found error
23    #[error("contract not found error: {0}")]
24    DataContractNotFound(&'static str),
25    /// Document type not found error
26    #[error("document type not found error: {0}")]
27    DocumentTypeNotFound(&'static str),
28
29    /// Duplicate non groupable clause on same field error
30    #[error("duplicate non groupable clause on same field error: {0}")]
31    DuplicateNonGroupableClauseSameField(&'static str),
32    /// Multiple in clauses error
33    #[error("multiple in clauses error: {0}")]
34    MultipleInClauses(&'static str),
35    /// Multiple range clauses error
36    #[error("multiple range clauses error: {0}")]
37    MultipleRangeClauses(&'static str),
38    /// Range clauses not groupable error
39    #[error("range clauses not groupable error: {0}")]
40    RangeClausesNotGroupable(&'static str),
41
42    /// Invalid between clause error
43    #[error("invalid BETWEEN clause error: {0}")]
44    InvalidBetweenClause(&'static str),
45    /// Invalid in clause error
46    #[error("invalid IN clause error: {0}")]
47    InvalidInClause(String),
48    /// Invalid starts with clause error
49    #[error("invalid STARTSWITH clause error: {0}")]
50    InvalidStartsWithClause(&'static str),
51
52    /// Invalid where clause order error
53    #[error("invalid where clause order error: {0}")]
54    InvalidWhereClauseOrder(&'static str),
55    /// Invalid where clause components error
56    #[error("invalid where clause components error: {0}")]
57    InvalidWhereClauseComponents(&'static str),
58
59    /// Invalid orderBy properties error
60    #[error("invalid order by properties error: {0}")]
61    InvalidOrderByProperties(&'static str),
62    /// Invalid orderBy properties order error
63    #[error("invalid order by properties order error: {0}")]
64    InvalidOrderByPropertiesOrder(&'static str),
65
66    /// Invalid contract id error
67    #[error("invalid contract id error: {0}")]
68    InvalidContractId(&'static str),
69    /// Query for a key has an invalid parameter
70    #[error("query invalid key parameter error: {0}")]
71    InvalidKeyParameter(String),
72    /// Query invalid limit error
73    #[error("query invalid limit error: {0}")]
74    InvalidLimit(String),
75    /// Query invalid parameter error
76    #[error("query invalid parameter error: {0}")]
77    InvalidParameter(String),
78    /// Query invalid format for where clause error
79    #[error("query invalid format for where clause error: {0}")]
80    InvalidFormatWhereClause(&'static str),
81
82    /// Conflicting conditions error
83    #[error("conflicting conditions error: {0}")]
84    ConflictingConditions(&'static str),
85
86    /// Duplicate start conditions error
87    #[error("duplicate start conditions error: {0}")]
88    DuplicateStartConditions(&'static str),
89    /// Start document not found error
90    #[error("start document not found error: {0}")]
91    StartDocumentNotFound(&'static str),
92
93    /// Invalid document type error
94    #[error("invalid document type error: {0}")]
95    InvalidDocumentType(&'static str),
96
97    /// Where clause on non indexed property error
98    #[error("where clause on non indexed property error: {0}")]
99    WhereClauseOnNonIndexedProperty(String),
100    /// Query is too far from index error
101    #[error("query is too far from index: {0}")]
102    QueryTooFarFromIndex(&'static str),
103    /// Query on document type with no indexes error
104    #[error("query on document type with no indexes: {0}")]
105    QueryOnDocumentTypeWithNoIndexes(&'static str),
106
107    /// Missing order by for range error
108    #[error("missing order by for range error: {0}")]
109    MissingOrderByForRange(&'static str),
110
111    /// Range operator not in final index error
112    #[error("range operator not in final index error: {0}")]
113    RangeOperatorNotInFinalIndex(&'static str),
114    /// In operator not in final indexes error
115    #[error("in operator not in final indexes error: {0}")]
116    InOperatorNotInFinalIndexesIndex(&'static str),
117    /// Range operator does not have order by error
118    #[error("range operator does not have order by error: {0}")]
119    RangeOperatorDoesNotHaveOrderBy(&'static str),
120
121    /// Validation error
122    #[error("validation error: {0}")]
123    Validation(&'static str),
124    /// Where condition properties number error
125    #[error("where condition properties number error: {0}")]
126    WhereConditionPropertiesNumber(&'static str),
127
128    /// Starts with illegal string error
129    #[error("starts with illegal string error: {0}")]
130    StartsWithIllegalString(&'static str),
131
132    /// Invalid identity prove request error
133    #[error("invalid identity prove request error: {0}")]
134    InvalidIdentityProveRequest(&'static str),
135
136    /// Requesting proof with offset error
137    #[error("requesting proof with offset error: {0}")]
138    RequestingProofWithOffset(String),
139
140    /// Unknown index error
141    #[error("unknown error: {0}")]
142    UnknownIndex(String),
143
144    /// Missing index values for query
145    #[error("incorrect index values error: {0}")]
146    IndexValuesError(String),
147}