public static Throwable maybeUnwrapException(Throwable t) {
        if (t instanceof CompletionException || t instanceof ExecutionException) {
            Throwable cause = t.getCause();
            return cause == null ? t : cause;
        } else {
            return t;
        }
    }
Check if a Throwable is a commonly wrapped exception type (e.g. `CompletionException`) and return
the cause if so. This is useful to handle cases where exceptions may be raised from a future or a
completion stage (as might be the case for requests sent to the controller in `ControllerApis`).

@param t The Throwable to check
@return The throwable itself or its cause if it is an instance of a commonly wrapped exception type
clients/src/main/java/org/apache/kafka/common/protocol/Errors.java