showuon commented on a change in pull request #10794: URL: https://github.com/apache/kafka/pull/10794#discussion_r642195443
########## 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 throwableToBeDecode = t; + // Future will wrap the original exception with completionException, which will return unexpected UNKNOWN_SERVER_ERROR. + if (t instanceof CompletionException) { + throwableToBeDecode = t.getCause(); Review comment: fix 1: unwrap the `CompletionException` to get the original exception inside. ########## 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