So I am looking at the way the error codes are propagated in the Java
client and we don't currently have something approximating what is in the
C++ code for the Status object.

C++ Status class:
https://github.com/apache/incubator-kudu/blob/master/src/kudu/util/status.h
Java RowError class:
https://github.com/apache/incubator-kudu/blob/master/java/kudu-client/src/main/java/org/kududb/client/RowError.java

This means that people who want to do specific error handling for things
like rows that are always present need to write something like this:

      List<OperationResponse> responses = session.flush();
      for (OperationResponse r : responses) {
        if (r.getStatus().equals("ALREADY_PRESENT")) {
          // Handle already present case...
        } else if (...) {
          // etc.
        }
      }

Hard-coding string values is unfortunate and error prone so I think we can
do better. It turns out that the values are already encoded in a protobuf @
https://github.com/apache/incubator-kudu/blob/master/src/kudu/common/wire_protocol.proto
so possibly the best approach would be to codegen a Java Status class from
the AppStatusPB somehow. Thoughts?

--
Mike Percy
Software Engineer, Cloudera

Reply via email to