Skip to content

Commit

Permalink
narrowing down aws sdk exception types that hard stop a build so that…
Browse files Browse the repository at this point in the history
… it can function offline
  • Loading branch information
duzinkie committed Apr 11, 2024
1 parent abe0adb commit 577e732
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import androidx.build.gradle.core.FileHandleInputStream
import androidx.build.gradle.core.FileHandleInputStream.Companion.handleInputStream
import androidx.build.gradle.core.StorageService
import org.gradle.api.logging.Logging
import software.amazon.awssdk.core.exception.SdkClientException
import software.amazon.awssdk.core.exception.SdkException
import software.amazon.awssdk.core.exception.SdkServiceException
import software.amazon.awssdk.core.sync.RequestBody
import software.amazon.awssdk.services.s3.S3Client
import software.amazon.awssdk.services.s3.model.DeleteObjectRequest
Expand Down Expand Up @@ -110,8 +112,8 @@ class S3StorageService(
client.headBucket(HeadBucketRequest.builder().bucket(bucketName).build())
} catch(e: NoSuchBucketException) {
throw Exception("Bucket $bucketName in $region cannot be found: ${e.message}")
} catch (e: SdkException ) {
throw Exception("AWS SDK exception on validating access to $bucketName in $region: ${e.message}")
} catch (e: SdkServiceException ) {
throw Exception("AWS SDK exception on validating access to $bucketName in $region: ${e::class.simpleName} - ${e.message}")
}
catch (e: Exception) {
logger.warn("Couldn't validate S3 client config: ${e.message}")
Expand Down

0 comments on commit 577e732

Please sign in to comment.