Skip to content

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Dec 5, 2024
1 parent bb1c279 commit 327a83e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ public Initializer initializer() {
log.debug("AWS credentials loaded (access key id: {})", credentials.accessKeyId());
}
boolean bucketExists = false;
Exception error = null;
Exception ex = null;
try (S3Client s3 = createS3Client()) {
bucketExists = s3.headBucket(HeadBucketRequest.builder().bucket(bucketName).build()) != null;
} catch (Exception e) { // NoSuchBucketException etc.
error = e;
ex = e;

Check warning on line 53 in bolt/src/main/java/com/slack/api/bolt/service/builtin/AmazonS3InstallationService.java

View check run for this annotation

Codecov / codecov/patch

bolt/src/main/java/com/slack/api/bolt/service/builtin/AmazonS3InstallationService.java#L52-L53

Added lines #L52 - L53 were not covered by tests
}
if (!bucketExists) {
String error = ex != null ? ex.getClass().getName() + ":" + ex.getMessage() : "-";
String message = "Failed to access the Amazon S3 bucket (name: " + bucketName + ", error: " + error + ")";
throw new IllegalStateException(message);

Check warning on line 58 in bolt/src/main/java/com/slack/api/bolt/service/builtin/AmazonS3InstallationService.java

View check run for this annotation

Codecov / codecov/patch

bolt/src/main/java/com/slack/api/bolt/service/builtin/AmazonS3InstallationService.java#L57-L58

Added lines #L57 - L58 were not covered by tests
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ public Initializer initializer() {
log.debug("AWS credentials loaded (access key id: {})", credentials.accessKeyId());
}
boolean bucketExists = false;
Exception error = null;
Exception ex = null;
try (S3Client s3 = createS3Client()) {
bucketExists = s3.headBucket(HeadBucketRequest.builder().bucket(bucketName).build()) != null;
} catch (Exception e) { // NoSuchBucketException etc.
error = e;
ex = e;

Check warning on line 49 in bolt/src/main/java/com/slack/api/bolt/service/builtin/AmazonS3OAuthStateService.java

View check run for this annotation

Codecov / codecov/patch

bolt/src/main/java/com/slack/api/bolt/service/builtin/AmazonS3OAuthStateService.java#L48-L49

Added lines #L48 - L49 were not covered by tests
}
if (!bucketExists) {
String error = ex != null ? ex.getClass().getName() + ":" + ex.getMessage() : "-";
String message = "Failed to access the Amazon S3 bucket (name: " + bucketName + ", error: " + error + ")";
throw new IllegalStateException(message);

Check warning on line 54 in bolt/src/main/java/com/slack/api/bolt/service/builtin/AmazonS3OAuthStateService.java

View check run for this annotation

Codecov / codecov/patch

bolt/src/main/java/com/slack/api/bolt/service/builtin/AmazonS3OAuthStateService.java#L53-L54

Added lines #L53 - L54 were not covered by tests
}
Expand Down

0 comments on commit 327a83e

Please sign in to comment.