allthingssecurity commented on code in PR #27798:
URL: https://github.com/apache/camel/pull/27798#discussion_r4267167816


##########
components/camel-kudu/src/main/java/org/apache/camel/component/kudu/KuduRowErrorException.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.kudu;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.kudu.client.RowError;
+
+/**
+ * Thrown by the producer when the response of an insert, delete, update or 
upsert carries a row error. There are two
+ * cases, and the {@link RowError#getErrorStatus() status} of the row error 
tells them apart:
+ * <ul>
+ * <li>a row that the tablet server rejected, for example because its key is 
already present (insert) or because the row
+ * is not found (update, delete): the row was not written;</li>
+ * <li>a request that failed, for example because it timed out or because no 
tablet server could be reached. The Kudu
+ * client reports such a request the same way in the default flush mode of a 
session. In this case it is not known
+ * whether the row was written.</li>
+ * </ul>
+ */
+public class KuduRowErrorException extends RuntimeCamelException {
+
+    private static final long serialVersionUID = 1L;
+
+    private final transient RowError rowError;
+
+    public KuduRowErrorException(RowError rowError) {
+        super("Kudu reported a row error for the operation: " + rowError);

Review Comment:
   Thanks, agreed and confirmed in kudu-client 1.18.1: `RowError.toString()` 
appends `operation.getRow()`, which prints the
   column values. Done in 6087d9da7b0e: the message is now `"Kudu reported a 
row error for the operation: " +
   rowError.getErrorStatus()`, for example `... operation: Already present: key 
already present`. The javadoc of
   `KuduRowErrorException` says that the message has the status only and that 
`getRowError()` gives the full row error.
   In `KuduProducerRowErrorTest` the row error stubs `getErrorStatus()` with 
`Status.AlreadyPresent("key already present")`
   (its `toString()` stub still returns a text with column values, which must 
not appear), and the timed-out case also
   checks the message. camel-kudu: 24 run, 0 failures, 12 skipped (the tests 
that need the Kudu harness, as before). With the exception class of the 
previous commit the four row error cases
   and the timed-out case fail on the message (it carried `row=(int32 id=5, 
string name=secret)`).
   
   _Claude Code on behalf of allthingssecurity_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to