File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ public enum Retry {
3939 do {
4040 return try block ( )
4141 } catch {
42+ logger. onError ( label: label, error: error)
4243 lastError = " \( error) "
4344 guard retriesLeft > 0 else { break }
4445 let delay = backedOffDelay ( baseDelay: delay, attempt: currentTry)
@@ -56,6 +57,7 @@ public enum Retry {
5657public protocol RetryLogging {
5758 func onStartOfRetry( label: String , attempt: Int )
5859 func onStartOfDelay( label: String , delay: Double )
60+ func onError( label: String , error: Error )
5961}
6062
6163
@@ -69,6 +71,10 @@ public struct DefaultLogger: RetryLogging {
6971 public func onStartOfDelay( label: String , delay: Double ) {
7072 print ( " Retrying in \( delay) seconds ... " )
7173 }
74+
75+ public func onError( label: String , error: Error ) {
76+ print ( error)
77+ }
7278}
7379
7480
You can’t perform that action at this time.
0 commit comments