Skip to content

Commit

Permalink
updating error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pmpailis committed Oct 18, 2024
1 parent 6f60880 commit 5a564ed
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,15 @@ public void onResponse(MultiSearchResponse items) {
}
}
if (false == failures.isEmpty()) {
IllegalStateException ex = new IllegalStateException("Search failed - some nested retrievers returned errors.");
failures.forEach(ex::addSuppressed);
listener.onFailure(ex);
if (failures.size() == 1) {
listener.onFailure(failures.getFirst());
} else {
IllegalArgumentException ex = new IllegalArgumentException(
"[" + getName() + "] search failed - some nested retrievers returned errors."
);
failures.forEach(ex::addSuppressed);
listener.onFailure(ex);
}
} else {
results.set(combineInnerRetrieverResults(topDocs));
listener.onResponse(null);
Expand Down

0 comments on commit 5a564ed

Please sign in to comment.