Skip to content

Commit

Permalink
Always return a task description even when it cannot be serialized.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock committed Mar 21, 2024
1 parent 53c0ce3 commit 098c81e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ public SearchTask(

@Override
public final String getDescription() {
return descriptionSupplier.get();
try {
return descriptionSupplier.get();
} catch(UnsupportedOperationException e) {
return e.getMessage();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public void testQueryLine() throws Exception {
public void testQueryLinearRing() throws Exception {
XContentBuilder xcb = createDefaultMapping();
client().admin().indices().prepareCreate("test").setMapping(xcb).get();

ensureGreen();

LinearRing linearRing = new LinearRing(new double[] { -25, -35, -25 }, new double[] { -25, -35, -25 });
Expand All @@ -143,8 +144,6 @@ public void testQueryLinearRing() throws Exception {
e.getCause().getMessage(),
containsString("Field [" + defaultGeoFieldName + "] does not support LINEARRING queries")
);
} catch (UnsupportedOperationException e) {
assertThat(e.getMessage(), containsString("line ring cannot be serialized using GeoJson"));
}
}

Expand Down

0 comments on commit 098c81e

Please sign in to comment.