Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix:S3): adds details to userInfo for NSError for TransferUtility #4115

Merged
merged 1 commit into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions AWSS3/AWSS3TransferUtility.m
Original file line number Diff line number Diff line change
Expand Up @@ -1991,23 +1991,28 @@ - (void)URLSession:(NSURLSession *)session
else {
HTTPResponse = (NSHTTPURLResponse *) task.response;
userInfo = [NSMutableDictionary dictionaryWithDictionary:[HTTPResponse allHeaderFields]];
userInfo[@"HTTPStatusCode"] = @(HTTPResponse.statusCode);
userInfo[NSLocalizedFailureReasonErrorKey] = [NSHTTPURLResponse localizedStringForStatusCode:HTTPResponse.statusCode];
}

if (!error) {
if (HTTPResponse.statusCode / 100 == 3
&& HTTPResponse.statusCode != 304) { // 304 Not Modified is a valid response.
userInfo[NSLocalizedDescriptionKey] = @"Redirection";
error = [NSError errorWithDomain:AWSS3TransferUtilityErrorDomain
code:AWSS3TransferUtilityErrorRedirection
userInfo:userInfo];
}

if (HTTPResponse.statusCode / 100 == 4) {
userInfo[NSLocalizedDescriptionKey] = @"Client Error";
error = [NSError errorWithDomain:AWSS3TransferUtilityErrorDomain
code:AWSS3TransferUtilityErrorClientError
userInfo:userInfo];
}

if (HTTPResponse.statusCode / 100 == 5) {
userInfo[NSLocalizedDescriptionKey] = @"Server Error";
error = [NSError errorWithDomain:AWSS3TransferUtilityErrorDomain
code:AWSS3TransferUtilityErrorServerError
userInfo:userInfo];
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@

- **AWSS3**

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

- fix: adds details to userInfo for NSError for TransferUtility (See [PR #4115](https://github.com/aws-amplify/aws-sdk-ios/pull/4115))


- fix: Reduces memory use for multipart uploads with `@autoreleasepool` to prevent excessive memory allocation (See [PR #4129](https://github.com/aws-amplify/aws-sdk-ios/pull/4129))
Comment on lines +9 to 12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- fix: adds details to userInfo for NSError for TransferUtility (See [PR #4115](https://github.com/aws-amplify/aws-sdk-ios/pull/4115))
- fix: Reduces memory use for multipart uploads with `@autoreleasepool` to prevent excessive memory allocation (See [PR #4129](https://github.com/aws-amplify/aws-sdk-ios/pull/4129))
- fix: adds details to userInfo for NSError for TransferUtility (See [PR #4115](https://github.com/aws-amplify/aws-sdk-ios/pull/4115))
- fix: Reduces memory use for multipart uploads with `@autoreleasepool` to prevent excessive memory allocation (See [PR #4129](https://github.com/aws-amplify/aws-sdk-ios/pull/4129))



## 2.27.8

### Bug Fixes

- **Pinpoint**
- **AWSPinpoint**
- fix: Updates Pinpoint to allow for push events for received and opened (See [PR #4105](https://github.com/aws-amplify/aws-sdk-ios/pull/4105))

### Misc. Updates
Expand Down