Releases: SwiftPackageIndex/Retry
Releases · SwiftPackageIndex/Retry
2.1.0
- Adds an overload to
attempt
with aState
parameter containing information about the current retry iteration:block: (State) throws → T
orblock: (State) async throws → T
. This allows you to act on that state in your retry block, for instance
try Retry.attempt("", delay: 0, retries: 3) { retry in
print(retry.isFirstIteration)
}
with State
:
public struct State {
public var retriesLeft: Int
public var currentTry = 0
public var lastError: Swift.Error?
public var isFirstIteration: Bool { currentTry == 0 }
public var hasRetriesLeft: Bool { retriesLeft > 0 }
mutating func advance() {
currentTry += 1
retriesLeft -= 1
}
}
2.0.0
- Changed
Retry.Error.retryLimitExceeded(lastError: String? = nil)
type toretryLimitExceeded(lastError: Swift.Error? = nil)
- Added
Retry.Error.abort(with: Swift.Error)
to be able to break out of retries in case of unrecoverable errors
1.0.0
- Added async overload
0.0.6
- Make
attempt
result discardable
0.0.5
- Add
RetryLogging.onError
0.0.4
- Rename
RetryLogger
→RetryLogging
0.0.3
- Add
label:
parameter toRetryLogger.onStartOfDelay
0.0.2
- Add
RetryLogger
protocol to support logging configuration - Fix public declarations
0.0.1
- Initial release