Manage AWS SDK exceptions to convert to the appropriate IO exceptions #6707
+128
−77
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Alternative for #6669
This pull request refactors error handling for AWS S3 operations throughout the Nextflow AWS NIO plugin. The main improvement is the consistent conversion of AWS SDK exceptions into standard Java IO exceptions, which simplifies error management and improves reliability. Several method signatures now declare
throws IOException, and exception handling logic has been centralized in theS3Clientclass. Related test cases have also been updated to reflect these changes.Error handling improvements:
Centralized AWS SDK exception conversion in
S3Client: All S3 operations now catchSdkExceptionand convert them to appropriate IO exceptions (NoSuchFileException,AccessDeniedException, etc.) via the newconvertAwsExceptionmethod. Method signatures have been updated to throwIOException.Updated dependent classes (
S3FileSystem,S3Iterator,S3ObjectSummaryLookup) to handleIOExceptionand wrap where necessary withUncheckedIOException. This ensures that errors propagate correctly and are handled uniformly.Refactored
getAccessControlandlookupmethods to throwIOExceptionand handle both bucket and object ACL retrieval more robustly. [1] [2]Test updates:
AwsS3NioTest.groovyto align with new error handling, ensuring correct exceptions are thrown and caught.Code cleanup:
Removed redundant AWS exception handling code from
S3FileSystemProviderand related classes, relying instead on the centralized logic inS3Client. [1] [2] [3]Removed unused imports and dead code related to old exception handling. [1] [2] [3]