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


##########
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:
   `RowError.toString()` includes `operation.getRow()`, and 
`PartialRow.toString()` prints every set column with its value (not only the 
key). This message ends up in the error handler's log, so row content would be 
logged for every rejected or timed-out write. Suggest building the message from 
the status only, which keeps the useful part ("Already present: key already 
present", "Timed out: ...") without the data:
   
   ```suggestion
           super("Kudu reported a row error for the operation: " + 
rowError.getErrorStatus());
   ```
   
   The expected message in `KuduProducerRowErrorTest` (line 124) and the 
`toString()` stub at line 89 need to change with it. For example, stub 
`getErrorStatus()` with `Status.AlreadyPresent("key already present")`.



-- 
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