Skip to content

Commit fb8eade

Browse files
authored
(fix:S3): adds details to userInfo for NSError for TransferUtility (#4115)
1 parent 55fc9cc commit fb8eade

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

AWSS3/AWSS3TransferUtility.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,23 +1991,28 @@ - (void)URLSession:(NSURLSession *)session
19911991
else {
19921992
HTTPResponse = (NSHTTPURLResponse *) task.response;
19931993
userInfo = [NSMutableDictionary dictionaryWithDictionary:[HTTPResponse allHeaderFields]];
1994+
userInfo[@"HTTPStatusCode"] = @(HTTPResponse.statusCode);
1995+
userInfo[NSLocalizedFailureReasonErrorKey] = [NSHTTPURLResponse localizedStringForStatusCode:HTTPResponse.statusCode];
19941996
}
19951997

19961998
if (!error) {
19971999
if (HTTPResponse.statusCode / 100 == 3
19982000
&& HTTPResponse.statusCode != 304) { // 304 Not Modified is a valid response.
2001+
userInfo[NSLocalizedDescriptionKey] = @"Redirection";
19992002
error = [NSError errorWithDomain:AWSS3TransferUtilityErrorDomain
20002003
code:AWSS3TransferUtilityErrorRedirection
20012004
userInfo:userInfo];
20022005
}
20032006

20042007
if (HTTPResponse.statusCode / 100 == 4) {
2008+
userInfo[NSLocalizedDescriptionKey] = @"Client Error";
20052009
error = [NSError errorWithDomain:AWSS3TransferUtilityErrorDomain
20062010
code:AWSS3TransferUtilityErrorClientError
20072011
userInfo:userInfo];
20082012
}
20092013

20102014
if (HTTPResponse.statusCode / 100 == 5) {
2015+
userInfo[NSLocalizedDescriptionKey] = @"Server Error";
20112016
error = [NSError errorWithDomain:AWSS3TransferUtilityErrorDomain
20122017
code:AWSS3TransferUtilityErrorServerError
20132018
userInfo:userInfo];

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66

77
- **AWSS3**
88

9+
- fix: adds details to userInfo for NSError for TransferUtility (See [PR #4115](https://github.com/aws-amplify/aws-sdk-ios/pull/4115))
10+
11+
912
- 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))
1013

1114

1215
## 2.27.8
1316

1417
### Bug Fixes
1518

16-
- **Pinpoint**
19+
- **AWSPinpoint**
1720
- 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))
1821

1922
### Misc. Updates

0 commit comments

Comments
 (0)