Hello,
I am reading through the example of searching for CatalogItem
s using which is presented here.
The very last call sends the prepared SearchCatalogItemsRequest
instance to the Square API, as follows:
catalogApi.searchCatalogItemsAsync(body).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});
I wanted to ask: if the search comes up empty, but does not fail for some other reason, will the exceptionally
method be applied, or not? The relevant Oracle JDK page for CompletionStage
is not necessarily illuminating: what do they mean by “when this stage completes exceptionally”? Is it guaranteed that an empty search is not covered by exceptionally()
?