fix: unwrap CompletionException in default client, rethrow as S3Encry…#162
Merged
fix: unwrap CompletionException in default client, rethrow as S3Encry…#162
Conversation
…ptionClientException
imabhichow
reviewed
May 25, 2023
| } catch (CompletionException e) { | ||
| throw new S3EncryptionClientException(e.getCause().getMessage(), e.getCause()); | ||
| } catch (Exception e) { | ||
| throw new S3EncryptionClientException("Unable to delete objects.", e); |
Contributor
There was a problem hiding this comment.
I guess the error message here is wrong for this method createMultipartUpload. Instead, we should be throwing e.getMessage().
imabhichow
reviewed
May 25, 2023
| } catch (CompletionException e) { | ||
| throw new S3EncryptionClientException(e.getCause().getMessage(), e.getCause()); | ||
| } catch (Exception e) { | ||
| throw new S3EncryptionClientException("Unable to delete objects.", e); |
Contributor
There was a problem hiding this comment.
Same here, the error message here is wrong for this method uploadPart. Instead, we should be throwing e.getMessage().
| } catch (CompletionException e) { | ||
| throw new S3EncryptionClientException(e.getCause().getMessage(), e.getCause()); | ||
| } catch (Exception e) { | ||
| throw new S3EncryptionClientException("Unable to delete objects.", e); |
Contributor
There was a problem hiding this comment.
Same here, the error message here is wrong for this method completeMultipartUpload. Instead, we should be throwing e.getMessage().
aws-crypto-tools-ci-bot
pushed a commit
that referenced
this pull request
Jun 1, 2023
### [3.0.1](v3.0.0...v3.0.1) (2023-06-01) ### Maintenance * add metadata downgrade tests([#55](#55)) ([0fed900](0fed900)) * fix some issues with release ([#156](#156)) ([c6b4e64](c6b4e64)) ### Fixes * null check for InputStream in ApiNameVersion ([#161](#161)) ([c23aeb2](c23aeb2)) * unwrap CompletionException in default client, rethrow as S3Encry… ([#162](#162)) ([1a00d3e](1a00d3e))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
…ptionClientException
Issue #, if available: #160
Description of changes: The "default" (non-async) S3 Encryption Client implementation is to block on the async API. In all of the operations (except
getObject), the client does not unwrap theCompletionExceptionwhich the async API wraps any failure with. The default API is expected to not be async, so it should not throwCompletionException. Furthermore, S3EC v3 moves to wrapping exceptions inS3EncryptionClientException(and its subclasses) so the correct behavior is to unwrapCompletionExceptionand rethrow the actual exception wrapped inS3EncryptionClientException.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Check any applicable: