Jean-Daniel Cryans has uploaded a new change for review. http://gerrit.cloudera.org:8080/3055
Change subject: RFC [java client] Redo how we manage exceptions ...................................................................... RFC [java client] Redo how we manage exceptions Right now the exceptions are hard to handle in the Java client. They're all generic and you need to do a lot of introspection. For example, if you try to create a table that already exists, you need to start searching the exception's message to know if it's that or some other problem that gave you the error. This patch is the third of a series of attempts at simplifying this. With this patch we now only have two kinds of concrete exceptions. Here's the tree: KuduException | \-> RecoverableException | \-> NonRecoverableException The parent class has a new field, `status`, which is your regular Kudu Status object. Wherever we can we try to recreate the Status objects that are sent to us from the servers, else we create our own. Now for the example above we can just query the exception's status with `isNotFound()`. There's more work than just what's in this patch. We could convert all the generic exceptions caused by Deferreds into KuduException by using a single errback, then our sync APIs could return that too. But first I'd like to get some comments on my approach. Change-Id: Iba6e8a022d7a5391c3657cbdc9d3f06f951be048 --- M java/kudu-client/src/main/java/org/kududb/client/AsyncKuduClient.java M java/kudu-client/src/main/java/org/kududb/client/AsyncKuduScanner.java M java/kudu-client/src/main/java/org/kududb/client/AsyncKuduSession.java D java/kudu-client/src/main/java/org/kududb/client/ConnectionResetException.java M java/kudu-client/src/main/java/org/kududb/client/GetMasterRegistrationReceived.java D java/kudu-client/src/main/java/org/kududb/client/InvalidResponseException.java M java/kudu-client/src/main/java/org/kududb/client/KuduClient.java M java/kudu-client/src/main/java/org/kududb/client/KuduException.java M java/kudu-client/src/main/java/org/kududb/client/KuduRpc.java M java/kudu-client/src/main/java/org/kududb/client/KuduRpcResponse.java D java/kudu-client/src/main/java/org/kududb/client/KuduServerException.java D java/kudu-client/src/main/java/org/kududb/client/MasterErrorException.java M java/kudu-client/src/main/java/org/kududb/client/NoLeaderMasterFoundException.java M java/kudu-client/src/main/java/org/kududb/client/NonRecoverableException.java M java/kudu-client/src/main/java/org/kududb/client/PleaseThrottleException.java M java/kudu-client/src/main/java/org/kududb/client/RecoverableException.java M java/kudu-client/src/main/java/org/kududb/client/RowResultIterator.java M java/kudu-client/src/main/java/org/kududb/client/Status.java M java/kudu-client/src/main/java/org/kududb/client/TabletClient.java D java/kudu-client/src/main/java/org/kududb/client/TabletServerErrorException.java M java/kudu-client/src/test/java/org/kududb/client/TestAsyncKuduSession.java M java/kudu-client/src/test/java/org/kududb/client/TestKuduTable.java 22 files changed, 192 insertions(+), 357 deletions(-) git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/55/3055/1 -- To view, visit http://gerrit.cloudera.org:8080/3055 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iba6e8a022d7a5391c3657cbdc9d3f06f951be048 Gerrit-PatchSet: 1 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Jean-Daniel Cryans
