Skip to content

Commit 577e732

Browse files
committed
narrowing down aws sdk exception types that hard stop a build so that it can function offline
1 parent abe0adb commit 577e732

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

s3buildcache/src/main/kotlin/androidx/build/gradle/s3buildcache/S3StorageService.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ import androidx.build.gradle.core.FileHandleInputStream
2121
import androidx.build.gradle.core.FileHandleInputStream.Companion.handleInputStream
2222
import androidx.build.gradle.core.StorageService
2323
import org.gradle.api.logging.Logging
24+
import software.amazon.awssdk.core.exception.SdkClientException
2425
import software.amazon.awssdk.core.exception.SdkException
26+
import software.amazon.awssdk.core.exception.SdkServiceException
2527
import software.amazon.awssdk.core.sync.RequestBody
2628
import software.amazon.awssdk.services.s3.S3Client
2729
import software.amazon.awssdk.services.s3.model.DeleteObjectRequest
@@ -110,8 +112,8 @@ class S3StorageService(
110112
client.headBucket(HeadBucketRequest.builder().bucket(bucketName).build())
111113
} catch(e: NoSuchBucketException) {
112114
throw Exception("Bucket $bucketName in $region cannot be found: ${e.message}")
113-
} catch (e: SdkException ) {
114-
throw Exception("AWS SDK exception on validating access to $bucketName in $region: ${e.message}")
115+
} catch (e: SdkServiceException ) {
116+
throw Exception("AWS SDK exception on validating access to $bucketName in $region: ${e::class.simpleName} - ${e.message}")
115117
}
116118
catch (e: Exception) {
117119
logger.warn("Couldn't validate S3 client config: ${e.message}")

0 commit comments

Comments
 (0)