public static void invokeOnError(AsyncMethodCallback<?> callback, Throwable cause) {
        requireNonNull(callback, "callback");
        requireNonNull(cause, "cause");
        if (cause instanceof Exception) {
            callback.onError((Exception) cause);
        } else {
            callback.onError(new CompletionException(cause.toString(), cause));
        }
    }
Invokes {@link AsyncMethodCallback#onError(Exception)}. If the specified {@code cause} is not an
{@link Exception}, it will be wrapped with a {@link CompletionException}.
thrift/thrift0.13/src/main/java/com/linecorp/armeria/common/thrift/AsyncMethodCallbacks.java