Skip to content

Commit 15c6e9e

Browse files
Flossyclaude
andcommitted
fix: Throw exception on bucket creation failure in S3VolumeManager
Fixes #210 Changed ensureBucketExists() to throw RuntimeException when bucket creation or verification fails, instead of silently swallowing the exception. This prevents S3VolumeManager from entering an initialized state when the bucket doesn't actually exist. Changes: - Throw RuntimeException when createBucket() fails - Throw RuntimeException when headBucket() fails (outer catch) - Add success log message after bucket creation - Include clear error messages about credentials and permissions - Wrap original exception as cause for debugging Before this fix, start() would set initialized=true even when bucket creation failed, leaving the manager in a broken state where all subsequent operations would fail with confusing errors. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 124bd79 commit 15c6e9e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

jplatform-storage-s3/src/main/java/org/flossware/jplatform/storage/s3/S3VolumeManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,15 @@ private void ensureBucketExists() {
308308
s3Client.createBucket(CreateBucketRequest.builder()
309309
.bucket(config.getBucketName())
310310
.build());
311+
logger.info("Successfully created bucket: {}", config.getBucketName());
311312
} catch (Exception ex) {
312313
logger.error("Failed to create bucket: " + config.getBucketName(), ex);
314+
throw new RuntimeException("Failed to create S3 bucket: " + config.getBucketName() +
315+
". Check credentials and permissions.", ex);
313316
}
317+
} catch (Exception e) {
318+
logger.error("Failed to verify bucket existence: " + config.getBucketName(), e);
319+
throw new RuntimeException("Failed to verify S3 bucket: " + config.getBucketName(), e);
314320
}
315321
}
316322

0 commit comments

Comments
 (0)