From 2ddecc311f5b865e8182719d8c13846e6d890049 Mon Sep 17 00:00:00 2001 From: Mubelotix Date: Tue, 19 Aug 2025 14:29:07 +0200 Subject: [PATCH] Improve error message --- crates/filter-parser/src/error.rs | 2 +- crates/filter-parser/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/filter-parser/src/error.rs b/crates/filter-parser/src/error.rs index aec008977..9f14ef2e8 100644 --- a/crates/filter-parser/src/error.rs +++ b/crates/filter-parser/src/error.rs @@ -213,7 +213,7 @@ impl Display for Error<'_> { writeln!(f, "The `_geoPolygon` filter expects at least 2 points")?; } ErrorKind::GeoCoordinatesNotPair(number) => { - writeln!(f, "Expected coordinates in the form of a pair of numbers but found a group of {number} numbers instead.")? + writeln!(f, "Was expecting 2 coordinates but instead found {number}.")? } ErrorKind::ReservedGeo(name) => { writeln!(f, "`{}` is a reserved keyword and thus can't be used as a filter expression. Use the `_geoRadius(latitude, longitude, distance)` or `_geoBoundingBox([latitude, longitude], [latitude, longitude])` built-in rules to filter on `_geo` coordinates.", name.escape_debug())? diff --git a/crates/filter-parser/src/lib.rs b/crates/filter-parser/src/lib.rs index bc11f7756..4f4472778 100644 --- a/crates/filter-parser/src/lib.rs +++ b/crates/filter-parser/src/lib.rs @@ -950,7 +950,7 @@ pub mod tests { "); insta::assert_snapshot!(p("_geoPolygon([1,2],[1,2,3])"), @r" - Expected coordinates in the form of a pair of numbers but found a group of 3 numbers instead. + Was expecting 2 coordinates but instead found 3. 20:21 _geoPolygon([1,2],[1,2,3]) ");