From 3b05bf1532da311076b5e60e1d6d7a0a7f732ee5 Mon Sep 17 00:00:00 2001 From: pmscosta Date: Wed, 14 Feb 2024 17:23:27 +0000 Subject: [PATCH 1/3] Correctly use isRetryable flag on exception handler --- aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala b/aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala index f9143b0a..43a1a1af 100644 --- a/aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala +++ b/aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala @@ -332,7 +332,7 @@ class S3Bucket( } case ex: AmazonServiceException => - logger.error(s"Service error: ${ex.getMessage}", ex); ex.isRetryable + logger.error(s"Service error: ${ex.getMessage}", ex); !ex.isRetryable case ex: AmazonClientException if ex.getMessage == @@ -340,7 +340,7 @@ class S3Bucket( logger.error("Unable to load AWS credentials", ex); true case ex: AmazonClientException => - logger.error("Client error pulling file", ex); ex.isRetryable + logger.error("Client error pulling file", ex); !ex.isRetryable case ex: Exception => logger.error("An error occurred", ex); false From 741bb0a969189b1319c9f2f3f61511f4b310fdb3 Mon Sep 17 00:00:00 2001 From: pmscosta Date: Wed, 14 Feb 2024 17:23:43 +0000 Subject: [PATCH 2/3] Add FIXME note about isRetryable method --- aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala b/aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala index 43a1a1af..4a4118bb 100644 --- a/aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala +++ b/aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala @@ -315,6 +315,8 @@ class S3Bucket( s3.getObject(req).getObjectContent } + /** FIXME: We should not rely on the [[AmazonClientException#isRetryable]] method since it's for internal use. + */ private[this] def handler: PartialFunction[Throwable, Boolean] = { case ex: AmazonS3Exception => ex.getStatusCode match { From ccc3846495a61329da839890a8f44001d7d922ec Mon Sep 17 00:00:00 2001 From: pmscosta Date: Wed, 14 Feb 2024 17:30:06 +0000 Subject: [PATCH 3/3] Fix formatting --- aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala b/aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala index 4a4118bb..43146aa3 100644 --- a/aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala +++ b/aws/src/main/scala/com/velocidi/apso/aws/S3Bucket.scala @@ -316,7 +316,7 @@ class S3Bucket( } /** FIXME: We should not rely on the [[AmazonClientException#isRetryable]] method since it's for internal use. - */ + */ private[this] def handler: PartialFunction[Throwable, Boolean] = { case ex: AmazonS3Exception => ex.getStatusCode match {