Skip to content

Commit 43baf5b

Browse files
kamilkisielalutter
authored andcommitted
graph: Adds attestable ChildFilterNestingNotSupportedError
1 parent e8ee79a commit 43baf5b

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

graph/src/components/store/err.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ pub enum StoreError {
2929
MalformedDirective(String),
3030
#[error("query execution failed: {0}")]
3131
QueryExecutionError(String),
32+
#[error("Child filter nesting not supported by value `{0}`: `{1}`")]
33+
ChildFilterNestingNotSupportedError(String, String),
3234
#[error("invalid identifier: {0}")]
3335
InvalidIdentifier(String),
3436
#[error(
@@ -98,6 +100,9 @@ impl Clone for StoreError {
98100
}
99101
Self::MalformedDirective(arg0) => Self::MalformedDirective(arg0.clone()),
100102
Self::QueryExecutionError(arg0) => Self::QueryExecutionError(arg0.clone()),
103+
Self::ChildFilterNestingNotSupportedError(arg0, arg1) => {
104+
Self::ChildFilterNestingNotSupportedError(arg0.clone(), arg1.clone())
105+
}
101106
Self::InvalidIdentifier(arg0) => Self::InvalidIdentifier(arg0.clone()),
102107
Self::DuplicateBlockProcessing(arg0, arg1) => {
103108
Self::DuplicateBlockProcessing(arg0.clone(), arg1.clone())

graph/src/data/query/error.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ pub enum QueryExecutionError {
4949
EntityFieldError(String, String),
5050
ListTypesError(String, Vec<String>),
5151
ListFilterError(String),
52+
ChildFilterNestingNotSupportedError(String, String),
5253
ValueParseError(String, String),
5354
AttributeTypeError(String, String),
5455
EntityParseError(String),
@@ -96,6 +97,7 @@ impl QueryExecutionError {
9697
| OrderByNotSupportedError(_, _)
9798
| OrderByNotSupportedForType(_)
9899
| FilterNotSupportedError(_, _)
100+
| ChildFilterNestingNotSupportedError(_, _)
99101
| UnknownField(_, _, _)
100102
| EmptyQuery
101103
| MultipleSubscriptionFields
@@ -201,6 +203,9 @@ impl fmt::Display for QueryExecutionError {
201203
FilterNotSupportedError(value, filter) => {
202204
write!(f, "Filter not supported by value `{}`: `{}`", value, filter)
203205
}
206+
ChildFilterNestingNotSupportedError(value, filter) => {
207+
write!(f, "Child filter nesting not supported by value `{}`: `{}`", value, filter)
208+
}
204209
UnknownField(_, t, s) => {
205210
write!(f, "Type `{}` has no field `{}`", t, s)
206211
}
@@ -309,6 +314,9 @@ impl From<StoreError> for QueryExecutionError {
309314
StoreError::DeploymentNotFound(id_or_name) => {
310315
QueryExecutionError::DeploymentNotFound(id_or_name)
311316
}
317+
StoreError::ChildFilterNestingNotSupportedError(attr, filter) => {
318+
QueryExecutionError::ChildFilterNestingNotSupportedError(attr, filter)
319+
}
312320
_ => QueryExecutionError::StoreError(CloneableAnyhowError(Arc::new(e.into()))),
313321
}
314322
}

store/postgres/src/relational_queries.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,8 +973,9 @@ impl<'a> QueryFilter<'a> {
973973
}
974974
Child(child) => {
975975
if child_filter_ancestor {
976-
return Err(StoreError::QueryExecutionError(
977-
"Child filters can not be nested".to_string(),
976+
return Err(StoreError::ChildFilterNestingNotSupportedError(
977+
child.attr.to_string(),
978+
filter.to_string(),
978979
));
979980
}
980981

0 commit comments

Comments
 (0)