showuon commented on a change in pull request #10794:
URL: https://github.com/apache/kafka/pull/10794#discussion_r654866143



##########
File path: clients/src/main/java/org/apache/kafka/common/requests/ApiError.java
##########
@@ -36,10 +37,16 @@
     private final String message;
 
     public static ApiError fromThrowable(Throwable t) {
+        Throwable throwableToBeEncode = t;
+        // Future will wrap the original exception with completionException, 
which will return unexpected UNKNOWN_SERVER_ERROR.
+        if (t instanceof CompletionException) {
+            throwableToBeEncode = t.getCause();

Review comment:
       fix 1: unwrap the `CompletionException` to get the original exception 
inside. Even if we don't want the `NotControllerException` return back to 
client, we need to know it to do some check.

##########
File path: clients/src/main/java/org/apache/kafka/common/requests/ApiError.java
##########
@@ -36,10 +37,16 @@
     private final String message;
 
     public static ApiError fromThrowable(Throwable t) {
+        Throwable throwableToBeEncode = t;
+        // Future will wrap the original exception with completionException, 
which will return unexpected UNKNOWN_SERVER_ERROR.
+        if (t instanceof CompletionException) {
+            throwableToBeEncode = t.getCause();

Review comment:
       fix 1: unwrap the CompletionException to get the original exception 
inside.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to