summaryrefslogtreecommitdiff
path: root/src/graphql
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphql')
-rw-r--r--src/graphql/types/alert.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/graphql/types/alert.rs b/src/graphql/types/alert.rs
index ba93c03..2e7f10b 100644
--- a/src/graphql/types/alert.rs
+++ b/src/graphql/types/alert.rs
@@ -216,7 +216,15 @@ pub mod mutations {
let polygon = format!("ST_MakePolygon(ST_MakeLine(ARRAY[{}]))", points);
let valid_query = format!("SELECT ST_IsValid({}) as is_valid", polygon);
- let rows = client.query(&valid_query, &[]).await.unwrap();
+ let rows;
+ match client.query(&valid_query, &[]).await {
+ Ok(r) => {
+ rows = r;
+ }
+ Err(_) => {
+ return Err(async_graphql::Error::new("Polygon is not valid"));
+ }
+ };
let is_valid: bool = rows[0].get("is_valid");
if !is_valid {