@@ -12,6 +12,8 @@ import protocol SmithyRetriesAPI.RetryErrorInfoProvider
12
12
import struct Foundation. TimeInterval
13
13
import class Foundation. NSError
14
14
import var Foundation. NSURLErrorDomain
15
+ import struct AwsCommonRuntimeKit. CRTError
16
+ import enum AwsCommonRuntimeKit. CommonRunTimeError
15
17
16
18
public enum DefaultRetryErrorInfoProvider : RetryErrorInfoProvider , Sendable {
17
19
/// Returns information used to determine how & if to retry an error.
@@ -41,6 +43,21 @@ public enum DefaultRetryErrorInfoProvider: RetryErrorInfoProvider, Sendable {
41
43
// NSURLErrorTimedOut = -1001
42
44
// "The request timed out."
43
45
return . init( errorType: . transient, retryAfterHint: nil , isTimeout: true )
46
+ } else if let crtError = error as? CommonRunTimeError ,
47
+ case . crtError( let crtErrorStruct) = crtError,
48
+ crtErrorStruct. code == 1051 {
49
+ // Retries CRTError(code: 1051, message: "socket is closed.", name: "AWS_IO_SOCKET_CLOSED"))
50
+ return . init( errorType: . transient, retryAfterHint: nil , isTimeout: false )
51
+ } else if let crtError = error as? CommonRunTimeError ,
52
+ case . crtError( let crtErrorStruct) = crtError,
53
+ crtErrorStruct. code == 1048 {
54
+ // Retries CRTError(code: 1048, message: "socket operation timed out.", name: "AWS_IO_SOCKET_TIMEOUT"))
55
+ return . init( errorType: . transient, retryAfterHint: nil , isTimeout: true )
56
+ } else if let crtError = error as? CommonRunTimeError ,
57
+ case . crtError( let crtErrorStruct) = crtError,
58
+ crtErrorStruct. code == 1067 {
59
+ // Retries CRTError(code: 1067, message: "Channel shutdown due to tls negotiation timeout", name: "AWS_IO_TLS_NEGOTIATION_TIMEOUT"))
60
+ return . init( errorType: . transient, retryAfterHint: nil , isTimeout: true )
44
61
}
45
62
return nil
46
63
}
0 commit comments