Skip to content

Commit cf3654e

Browse files
committed
Unwrap CompletionException in GrpcClient
GrpcClient expects Exceptions of a specific type but as it is right now it will not handle any exceptions as they are propagated as CompletionException This will not solve any similar issues for any other class using ClientTelemetry, and a better solution would probably be to never wrap the exception, however that would require more intrusive changes to the future chain. Fixes #287
1 parent cdd1ca2 commit cf3654e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

db-client-java/src/main/java/com/eventstore/dbclient/GrpcClient.java

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.Optional;
1010
import java.util.UUID;
1111
import java.util.concurrent.CompletableFuture;
12+
import java.util.concurrent.CompletionException;
1213
import java.util.concurrent.LinkedBlockingQueue;
1314
import java.util.concurrent.atomic.AtomicBoolean;
1415
import java.util.function.Function;
@@ -79,6 +80,10 @@ public <A> CompletableFuture<A> runWithArgs(Function<WorkItemArgs, CompletableFu
7980
}
8081

8182
try {
83+
if (error instanceof CompletionException) {
84+
error = error.getCause();
85+
}
86+
8287
if (error instanceof NotLeaderException) {
8388
NotLeaderException ex = (NotLeaderException) error;
8489
// TODO - Currently we don't retry on not leader exception but we might consider

0 commit comments

Comments
 (0)