From b6ebe9c27eda2969520480ede2c1a3c34ee86d0d Mon Sep 17 00:00:00 2001 From: Evaldas Buinauskas <7301441+buinauskas@users.noreply.github.com> Date: Wed, 20 Dec 2023 13:22:56 +0200 Subject: [PATCH] Update the exception handler to look for string patterns (#21) --- .../kafka/connect/vespa/feeders/VespaFeederHandler.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/vinted/kafka/connect/vespa/feeders/VespaFeederHandler.java b/src/main/java/com/vinted/kafka/connect/vespa/feeders/VespaFeederHandler.java index 627cd27..c28c7ff 100644 --- a/src/main/java/com/vinted/kafka/connect/vespa/feeders/VespaFeederHandler.java +++ b/src/main/java/com/vinted/kafka/connect/vespa/feeders/VespaFeederHandler.java @@ -3,7 +3,6 @@ import ai.vespa.feed.client.DocumentId; import ai.vespa.feed.client.OperationParseException; import ai.vespa.feed.client.Result; -import ai.vespa.feed.client.ResultParseException; import com.fasterxml.jackson.core.JsonParseException; import com.vinted.kafka.connect.vespa.VespaReporter; import com.vinted.kafka.connect.vespa.VespaSinkConfig; @@ -107,11 +106,11 @@ private static boolean isMalformed(Throwable throwable) { .findFirst() .orElse(throwable); - String rootCauseString = rootCause.toString().toLowerCase(); + String throwableString = throwable.toString().toLowerCase(); - return !(rootCause instanceof ResultParseException) - && (rootCauseString.contains("status 400") - || rootCauseString.contains("string field value contains illegal code point") + return !(throwableString.contains("resultparseexception")) + && (throwableString.contains("status 400") + || throwableString.contains("string field value contains illegal code point") || rootCause instanceof OperationParseException || rootCause instanceof JsonParseException); }