Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 44309e7

Browse files
committed
Update CustomNSError to contain underlyingError for connection errors
1 parent a7fc344 commit 44309e7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

WordPressKit/PostServiceRemoteREST.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ + (RemotePost *)remotePostFromJSONDictionary:(NSDictionary *)jsonPost {
477477

478478
post.isStickyPost = [jsonPost numberForKeyPath:@"sticky"];
479479

480-
// FIXME: remove conversion once API is fixed #38-;
480+
// FIXME: remove conversion once API is fixed #38-io
481481
// metadata should always be an array but it's returning false when there are no custom fields
482482
post.metadata = [jsonPost arrayForKey:@"metadata"];
483483
// Or even worse, in some cases (Jetpack sites?) is an array containing false

WordPressKit/WordPressAPIError+NSErrorBrdige.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ extension WordPressAPIError: CustomNSError {
3737
switch self {
3838
case let .endpointError(endpointError):
3939
return (endpointError as NSError).userInfo
40-
case .requestEncodingFailure, .connection, .unacceptableStatusCode, .unparsableResponse,
40+
case .connection(let error):
41+
return [NSUnderlyingErrorKey: error]
42+
case .requestEncodingFailure, .unacceptableStatusCode, .unparsableResponse,
4143
.unknown:
4244
return [:]
4345
}
44-
4546
}
46-
4747
}
4848

4949
// MARK: - Bridge WordPressComRestApiEndpointError to NSError

0 commit comments

Comments
 (0)