EgbertW commented on code in PR #37166:
URL: https://github.com/apache/beam/pull/37166#discussion_r2647358547


##########
sdks/java/io/elasticsearch/src/main/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIO.java:
##########
@@ -2811,13 +2811,14 @@ protected void addAndMaybeFlush(Document doc, 
ProcessContext context)
       }
 
       private boolean isRetryableClientException(Throwable t) {
-        // RestClient#performRequest only throws wrapped IOException so we 
must inspect the
+        // RestClient#performRequest mainly throws wrapped IOException so we 
must inspect the
         // exception cause to determine if the exception is likely transient 
i.e. retryable or
-        // not.
+        // not. One exception is the ResponseException which is thrown when 
attempting to parse the
+        // response. This exception is not wrapped.
 
         // Retry for 500-range response code except for 501.
-        if (t.getCause() instanceof ResponseException) {
-          ResponseException ex = (ResponseException) t.getCause();
+        if (t instanceof ResponseException) {

Review Comment:
   Could be. I updated it to check both `t` and `t.getCause()`. I considered 
using `Throwables.getCausalChain` but it seems like overkill to me - and in 
that case it'd better be used for the other exception types as well.



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