You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/Retry/Retry.swift
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -100,7 +100,7 @@ public enum RetryStrategy<C> where C: Clock {
100
100
/// }
101
101
///
102
102
/// let (data, response) = try await retry {
103
-
/// let (data, response) = try await URLSession.shared.data(from: URL(string: "")!)
103
+
/// let (data, response) = try await URLSession.shared.data(from: url)
104
104
///
105
105
/// if
106
106
/// let response = response as? HTTPURLResponse,
@@ -129,7 +129,7 @@ public enum RetryStrategy<C> where C: Clock {
129
129
/// - clock: The clock used to wait for delays between retries.
130
130
/// - isolation: The inherited actor isolation.
131
131
/// - operation: The asynchronous operation to perform. This function will retry the operation in case of error, based on the retry strategy provided.
132
-
/// - strategy: A closure that determines the `RetryStrategy` for handling errors based on the error type. Defaults to `.backoff(.none)`, meaning no delay between retries.
132
+
/// - strategy: A closure that determines the `RetryStrategy` for handling retries based on the error type. Defaults to `.backoff(.none)`, meaning no delay between retries.
133
133
///
134
134
/// - Returns: The result of the operation, if successful within the allowed number of attempts.
135
135
/// - Throws: Rethrows the last encountered error if all retry attempts fail or if the retry strategy specifies stopping retries or any error thrown by `clock`
@@ -203,7 +203,7 @@ public func retry<R, E, C>(
203
203
/// }
204
204
///
205
205
/// let (data, response) = try await retry {
206
-
/// let (data, response) = try await URLSession.shared.data(from: URL(string: "")!)
206
+
/// let (data, response) = try await URLSession.shared.data(from: url)
207
207
///
208
208
/// if
209
209
/// let response = response as? HTTPURLResponse,
@@ -231,7 +231,7 @@ public func retry<R, E, C>(
231
231
/// - tolerance: An optional tolerance for the delay duration to account for clock imprecision. Defaults to `nil`.
232
232
/// - isolation: The inherited actor isolation.
233
233
/// - operation: The asynchronous operation to perform. This function will retry the operation in case of error, based on the retry strategy provided.
234
-
/// - strategy: A closure that determines the `RetryStrategy` for handling errors based on the error type. Defaults to `.backoff(.none)`, meaning no delay between retries.
234
+
/// - strategy: A closure that determines the `RetryStrategy` for handling retries based on the error type. Defaults to `.backoff(.none)`, meaning no delay between retries.
235
235
///
236
236
/// - Returns: The result of the operation, if successful within the allowed number of attempts.
237
237
/// - Throws: Rethrows the last encountered error if all retry attempts fail or if the retry strategy specifies stopping retries or any error thrown by `ContinuousClock`
@@ -286,7 +286,7 @@ public func retry<R, E>(
286
286
/// }
287
287
///
288
288
/// let (data, response) = try await retry {
289
-
/// let (data, response) = try await URLSession.shared.data(from: URL(string: "")!)
289
+
/// let (data, response) = try await URLSession.shared.data(from: url)
290
290
///
291
291
/// if
292
292
/// let response = response as? HTTPURLResponse,
@@ -314,7 +314,7 @@ public func retry<R, E>(
314
314
/// - tolerance: An optional tolerance for the delay duration to account for clock imprecision. Defaults to `nil`.
315
315
/// - clock: The clock used to wait for delays between retries.
316
316
/// - operation: The asynchronous operation to perform. This function will retry the operation in case of error, based on the retry strategy provided.
317
-
/// - strategy: A closure that determines the `RetryStrategy` for handling errors based on the error type. Defaults to `.backoff(.none)`, meaning no delay between retries.
317
+
/// - strategy: A closure that determines the `RetryStrategy` for handling retries based on the error type. Defaults to `.backoff(.none)`, meaning no delay between retries.
318
318
///
319
319
/// - Returns: The result of the operation, if successful within the allowed number of attempts.
320
320
/// - Throws: Rethrows the last encountered error if all retry attempts fail or if the retry strategy specifies stopping retries or any error thrown by `clock`
@@ -387,7 +387,7 @@ public func retry<R, C>(
387
387
/// }
388
388
///
389
389
/// let (data, response) = try await retry {
390
-
/// let (data, response) = try await URLSession.shared.data(from: URL(string: "")!)
390
+
/// let (data, response) = try await URLSession.shared.data(from: url)
391
391
///
392
392
/// if
393
393
/// let response = response as? HTTPURLResponse,
@@ -414,7 +414,7 @@ public func retry<R, C>(
414
414
/// - maxAttempts: The maximum number of attempts to retry the operation. Defaults to 3.
415
415
/// - tolerance: An optional tolerance for the delay duration to account for clock imprecision. Defaults to `nil`.
416
416
/// - operation: The asynchronous operation to perform. This function will retry the operation in case of error, based on the retry strategy provided.
417
-
/// - strategy: A closure that determines the `RetryStrategy` for handling errors based on the error type. Defaults to `.backoff(.none)`, meaning no delay between retries.
417
+
/// - strategy: A closure that determines the `RetryStrategy` for handling retries based on the error type. Defaults to `.backoff(.none)`, meaning no delay between retries.
418
418
///
419
419
/// - Returns: The result of the operation, if successful within the allowed number of attempts.
420
420
/// - Throws: Rethrows the last encountered error if all retry attempts fail or if the retry strategy specifies stopping retries or any error thrown by `ContinuousClock`
0 commit comments