@@ -83,6 +83,63 @@ pub enum QueryExecutionError {
83
83
ResultTooBig ( usize , usize ) ,
84
84
}
85
85
86
+ impl QueryExecutionError {
87
+ pub fn is_attestable ( & self ) -> bool {
88
+ use self :: QueryExecutionError :: * ;
89
+ match self {
90
+ OperationNameRequired
91
+ | OperationNotFound ( _)
92
+ | NotSupported ( _)
93
+ | NoRootSubscriptionObjectType
94
+ | NamedTypeError ( _)
95
+ | AbstractTypeError ( _)
96
+ | InvalidArgumentError ( _, _, _)
97
+ | MissingArgumentError ( _, _)
98
+ | InvalidVariableTypeError ( _, _)
99
+ | MissingVariableError ( _, _)
100
+ | OrderByNotSupportedError ( _, _)
101
+ | OrderByNotSupportedForType ( _)
102
+ | FilterNotSupportedError ( _, _)
103
+ | UnknownField ( _, _, _)
104
+ | EmptyQuery
105
+ | MultipleSubscriptionFields
106
+ | SubgraphDeploymentIdError ( _)
107
+ | InvalidFilterError
108
+ | EntityFieldError ( _, _)
109
+ | ListTypesError ( _, _)
110
+ | ListFilterError ( _)
111
+ | AttributeTypeError ( _, _)
112
+ | EmptySelectionSet ( _)
113
+ | Unimplemented ( _)
114
+ | CyclicalFragment ( _)
115
+ | UndefinedFragment ( _)
116
+ | FulltextQueryRequiresFilter => true ,
117
+ NonNullError ( _, _)
118
+ | ListValueError ( _, _)
119
+ | ResolveEntitiesError ( _)
120
+ | RangeArgumentsError ( _, _, _)
121
+ | ValueParseError ( _, _)
122
+ | EntityParseError ( _)
123
+ | StoreError ( _)
124
+ | Timeout
125
+ | EnumCoercionError ( _, _, _, _, _)
126
+ | ScalarCoercionError ( _, _, _, _)
127
+ | AmbiguousDerivedFromResult ( _, _, _, _)
128
+ | TooComplex ( _, _)
129
+ | TooDeep ( _)
130
+ | IncorrectPrefetchResult { .. }
131
+ | Panic ( _)
132
+ | EventStreamError
133
+ | TooExpensive
134
+ | Throttled
135
+ | DeploymentReverted
136
+ | SubgraphManifestResolveError ( _)
137
+ | InvalidSubgraphManifest
138
+ | ResultTooBig ( _, _) => false ,
139
+ }
140
+ }
141
+ }
142
+
86
143
impl Error for QueryExecutionError {
87
144
fn description ( & self ) -> & str {
88
145
"Query execution error"
@@ -217,7 +274,7 @@ impl fmt::Display for QueryExecutionError {
217
274
EventStreamError => write ! ( f, "error in the subscription event stream" ) ,
218
275
FulltextQueryRequiresFilter => write ! ( f, "fulltext search queries can only use EntityFilter::Equal" ) ,
219
276
TooExpensive => write ! ( f, "query is too expensive" ) ,
220
- Throttled => write ! ( f, "service is overloaded and can not run the query right now. Please try again in a few minutes" ) ,
277
+ Throttled => write ! ( f, "service is overloaded and can not run the query right now. Please try again in a few minutes" ) ,
221
278
DeploymentReverted => write ! ( f, "the chain was reorganized while executing the query" ) ,
222
279
SubgraphManifestResolveError ( e) => write ! ( f, "failed to resolve subgraph manifest: {}" , e) ,
223
280
InvalidSubgraphManifest => write ! ( f, "invalid subgraph manifest file" ) ,
@@ -271,6 +328,16 @@ pub enum QueryError {
271
328
IndexingError ,
272
329
}
273
330
331
+ impl QueryError {
332
+ pub fn is_attestable ( & self ) -> bool {
333
+ match self {
334
+ QueryError :: EncodingError ( _) | QueryError :: ParseError ( _) => true ,
335
+ QueryError :: ExecutionError ( err) => err. is_attestable ( ) ,
336
+ QueryError :: IndexingError => false ,
337
+ }
338
+ }
339
+ }
340
+
274
341
impl From < FromUtf8Error > for QueryError {
275
342
fn from ( e : FromUtf8Error ) -> Self {
276
343
QueryError :: EncodingError ( e)
0 commit comments