Skip to content

Releases: SwiftPackageIndex/Retry

2.1.0

19 Dec 12:55
1056b62
Compare
Choose a tag to compare
  • Adds an overload to attempt with a State parameter containing information about the current retry iteration: block: (State) throws → T or block: (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

21 Jul 08:21
4fba683
Compare
Choose a tag to compare
  • Changed Retry.Error.retryLimitExceeded(lastError: String? = nil) type to retryLimitExceeded(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

04 Oct 10:35
88179ba
Compare
Choose a tag to compare
  • Added async overload

0.0.6

19 Jul 07:14
Compare
Choose a tag to compare
  • Make attempt result discardable

0.0.5

19 Jul 06:49
Compare
Choose a tag to compare
  • Add RetryLogging.onError

0.0.4

19 Jul 06:39
Compare
Choose a tag to compare
  • Rename RetryLoggerRetryLogging

0.0.3

19 Jul 06:33
Compare
Choose a tag to compare
  • Add label: parameter to RetryLogger.onStartOfDelay

0.0.2

18 Jul 10:55
4bb59cf
Compare
Choose a tag to compare
  • Add RetryLogger protocol to support logging configuration
  • Fix public declarations

0.0.1

18 Jul 10:24
Compare
Choose a tag to compare
  • Initial release