code: 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));
          }
      }
docs: Invokes {@link AsyncMethodCallback#onError(Exception)}. If the specified {@code cause} is not an
  {@link Exception}, it will be wrapped with a {@link CompletionException}.