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 {
39
39
do {
40
40
return try block ( )
41
41
} catch {
42
+ logger. onError ( label: label, error: error)
42
43
lastError = " \( error) "
43
44
guard retriesLeft > 0 else { break }
44
45
let delay = backedOffDelay ( baseDelay: delay, attempt: currentTry)
@@ -56,6 +57,7 @@ public enum Retry {
56
57
public protocol RetryLogging {
57
58
func onStartOfRetry( label: String , attempt: Int )
58
59
func onStartOfDelay( label: String , delay: Double )
60
+ func onError( label: String , error: Error )
59
61
}
60
62
61
63
@@ -69,6 +71,10 @@ public struct DefaultLogger: RetryLogging {
69
71
public func onStartOfDelay( label: String , delay: Double ) {
70
72
print ( " Retrying in \( delay) seconds ... " )
71
73
}
74
+
75
+ public func onError( label: String , error: Error ) {
76
+ print ( error)
77
+ }
72
78
}
73
79
74
80
You can’t perform that action at this time.
0 commit comments