File tree Expand file tree Collapse file tree
staccato-application/src/main/java/com/planet/staccato/exceptions
staccato-elasticsearch/src/main/java/com/planet/staccato/es Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ public Optional<StacException> compose(T ex) {
4040 // find a handler for the exception
4141 // if no handler is found,
4242 // loop into for its cause (ex.getCause())
43+ T originalEx = ex ;
4344 while (ex != null ) {
4445 handler = handlers .get (ex .getClass ().getSimpleName ());
4546
@@ -54,6 +55,12 @@ public Optional<StacException> compose(T ex) {
5455 return Optional .of (handler .getErrorResponse (ex ));
5556 }
5657
58+ if (ex == null ) {
59+ ex = originalEx ;
60+ }
61+
5762 return Optional .of (new StacException (String .valueOf (HttpStatus .BAD_REQUEST .value ()), ex .getMessage ()));
63+
64+
5865 }
5966}
Original file line number Diff line number Diff line change @@ -159,10 +159,15 @@ public static Optional<QueryBuilder> intersectsBuilder(Object intersects) {
159159 return Optional .empty ();
160160 }
161161 Map <String , Object > intersectsMap = (Map <String , Object >) intersects ;
162- Map <String , Object > geometryMap = (Map <String , Object >) intersectsMap .get ("geometry" );
163- String type = (String ) geometryMap .get ("type" );
162+ String type = (String ) intersectsMap .get ("type" );
163+ if (type == null || type .isBlank ()) {
164+ throw new FilterException ("Unable to determine geometry type from intersects parameter" );
165+ }
164166
165- List coords = (List ) geometryMap .get ("coordinates" );
167+ List coords = (List ) intersectsMap .get ("coordinates" );
168+ if (coords == null ) {
169+ throw new FilterException ("Unable to determine coordinates from intersects parameter" );
170+ }
166171 if (coords .isEmpty ()) {
167172 return Optional .empty ();
168173 }
You can’t perform that action at this time.
0 commit comments