Skip to content

Commit 53d9fb4

Browse files
authored
Merge pull request #76 from strvcom/dg/chore/make-api-error-public
chore: make APIManagerError public
2 parents 9b3b52a + 9f630e0 commit 53d9fb4

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Sources/Networking/Core/APIManager.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ public extension APIManager {
125125
}
126126

127127
private extension APIManager {
128-
func request(_ endpointRequest: EndpointRequest, retryConfiguration: RetryConfiguration?) async throws -> Response {
128+
func request(
129+
_ endpointRequest: EndpointRequest,
130+
retryConfiguration: RetryConfiguration?
131+
) async throws -> Response {
129132
do {
130133
// create original url request
131134
var request = try endpointRequest.endpoint.asRequest()
@@ -149,8 +152,12 @@ private extension APIManager {
149152
return response
150153
} catch {
151154
do {
152-
// If retry fails (retryCount is 0 or Task.sleep throwed), catch the error and process it with `ErrorProcessing` plugins.
153-
try await sleepIfRetry(for: error, endpointRequest: endpointRequest, retryConfiguration: retryConfiguration)
155+
// If retry fails (retryCount is 0 or Task.sleep thrown), catch the error and process it with `ErrorProcessing` plugins.
156+
try await sleepIfRetry(
157+
for: error,
158+
endpointRequest: endpointRequest,
159+
retryConfiguration: retryConfiguration
160+
)
154161
return try await request(endpointRequest, retryConfiguration: retryConfiguration)
155162
} catch {
156163
// error processing
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
/// An error in APIManager configuration..
4-
enum APIManagerError: Error {
4+
public enum APIManagerError: Error {
55
/// An indication that the urlSession has been invalidated but not recreated.
66
case invalidUrlSession
77
}

0 commit comments

Comments
 (0)