-
Notifications
You must be signed in to change notification settings - Fork 16
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
Remove PostServiceRemoteExtended
and implementations
#784
base: trunk
Are you sure you want to change the base?
Changes from all commits
96ae82f
d17587a
58a6386
19bbd29
61dbb4e
5571b03
be9635f
61f6a44
b03cc2d
a5edf0d
68e32b8
16f2af7
63ac625
b09ee31
72c8f7b
ed6a634
55d8e8f
f9a15a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,14 +18,10 @@ public enum WordPressAPIError<EndpointError>: Error where EndpointError: Localiz | |
/// The API call returned an status code that's unacceptable to the endpoint. | ||
case unacceptableStatusCode(response: HTTPURLResponse, body: Data) | ||
/// The API call returned an HTTP response that WordPressKit can't parse. Receiving this error could be an indicator that there is an error response that's not handled properly by WordPressKit. | ||
case unparsableResponse(response: HTTPURLResponse?, body: Data?, underlyingError: Error) | ||
case unparsableResponse(response: HTTPURLResponse?, body: Data?, underlyingError: Error = URLError(.cannotParseResponse)) | ||
/// Other error occured. | ||
case unknown(underlyingError: Error) | ||
|
||
static func unparsableResponse(response: HTTPURLResponse?, body: Data?) -> Self { | ||
return WordPressAPIError<EndpointError>.unparsableResponse(response: response, body: body, underlyingError: URLError(.cannotParseResponse)) | ||
} | ||
Comment on lines
-21
to
-27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't look up when, but relatively recently, I think, Swift acquired default values for associated parameters. So we can remove this builder method in favor of defining the underlying error as a default for the case. |
||
|
||
var response: HTTPURLResponse? { | ||
switch self { | ||
case .requestEncodingFailure, .connection, .unknown: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the type became
public
, apublic init
became necessary because the compiler does not synthesize one outside of the package.As for
encode(to:)
, it needs to bepublic
becauseEncodable
is declared as part of thepublic
type interface.🤔 In hindsight, I suppose the
Encodable
part could be moved into aninternal
extension, but I think it's okay to leave it as is. Let me know if you can think of a strong reason to hide it.