From e3401b980e7b22f8ec2627b7644d96fca1025d21 Mon Sep 17 00:00:00 2001 From: Mike Abdullah Date: Fri, 1 Nov 2013 11:31:46 +0000 Subject: [PATCH 1/2] Use +localizedStringForStatusCode: to provide a failure reason for errors --- Sources/Core/DAVRequest.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/Core/DAVRequest.m b/Sources/Core/DAVRequest.m index f97f31d..cd0f26b 100644 --- a/Sources/Core/DAVRequest.m +++ b/Sources/Core/DAVRequest.m @@ -102,13 +102,14 @@ - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)err - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { NSHTTPURLResponse *resp = (NSHTTPURLResponse *)response; NSInteger code = [resp statusCode]; + NSString *description = [resp.class localizedStringForStatusCode:code]; if (code >= 400) { [_connection cancel]; NSError *error = [NSError errorWithDomain:DAVClientErrorDomain code:code - userInfo:nil]; + userInfo:@{ NSLocalizedFailureReasonErrorKey : description }]; [self _didFail:error]; } From ee6a7bff0f6a7c522372a93c0cac2d6fc1a7baad Mon Sep 17 00:00:00 2001 From: Mike Abdullah Date: Fri, 1 Nov 2013 11:37:29 +0000 Subject: [PATCH 2/2] Use @"org.w3.http" for error domain since they define the HTTP protocol --- Sources/Core/DAVRequest.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Core/DAVRequest.m b/Sources/Core/DAVRequest.m index cd0f26b..0920608 100644 --- a/Sources/Core/DAVRequest.m +++ b/Sources/Core/DAVRequest.m @@ -20,7 +20,7 @@ - (void)_didFinish; @implementation DAVRequest -NSString *const DAVClientErrorDomain = @"com.MattRajca.DAVKit.error"; +NSString *const DAVClientErrorDomain = @"org.w3.http"; #define DEFAULT_TIMEOUT 60