summaryrefslogtreecommitdiffstats
path: root/vespa-feed-client
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2021-06-16 15:15:00 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2021-06-16 15:15:00 +0200
commita332b52cd6cbf17ffeb4ef3e81e405c81e5cb185 (patch)
treef6333ba40805ff7155fcae98d7cdae437d92b6a8 /vespa-feed-client
parent3c572dc7ddbccce8819bbcb259389e9ae72e1ede (diff)
Map exception at higher abstraction level where document id is known
Diffstat (limited to 'vespa-feed-client')
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/ApacheCluster.java4
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java8
2 files changed, 10 insertions, 2 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/ApacheCluster.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/ApacheCluster.java
index 7ae44fe8e9f..e5d45a2f211 100644
--- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/ApacheCluster.java
+++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/ApacheCluster.java
@@ -63,12 +63,12 @@ class ApacheCluster implements Cluster {
endpoint.client.execute(request,
new FutureCallback<SimpleHttpResponse>() {
@Override public void completed(SimpleHttpResponse response) { vessel.complete(new ApacheHttpResponse(response)); }
- @Override public void failed(Exception ex) { vessel.completeExceptionally(new FeedException(ex)); }
+ @Override public void failed(Exception ex) { vessel.completeExceptionally(ex); }
@Override public void cancelled() { vessel.cancel(false); }
});
}
catch (Throwable thrown) {
- vessel.completeExceptionally(new FeedException(thrown));
+ vessel.completeExceptionally(thrown);
}
vessel.whenComplete((__, ___) -> endpoint.inflight.decrementAndGet());
}
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java
index 6b2aec5d8b3..98ff3a5d921 100644
--- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java
+++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java
@@ -228,6 +228,14 @@ class HttpRequestStrategy implements RequestStrategy {
releaseSlot();
});
+ result.handle((response, error) -> {
+ if (error != null) {
+ if (error instanceof FeedException) throw (FeedException)error;
+ throw new FeedException(documentId, error);
+ }
+ return response;
+ });
+
return result;
}