diff --git a/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift b/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift index 7e51218b3..250adae58 100644 --- a/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift +++ b/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift @@ -12,6 +12,8 @@ import protocol SmithyRetriesAPI.RetryErrorInfoProvider import struct Foundation.TimeInterval import class Foundation.NSError import var Foundation.NSURLErrorDomain +import struct AwsCommonRuntimeKit.CRTError +import enum AwsCommonRuntimeKit.CommonRunTimeError public enum DefaultRetryErrorInfoProvider: RetryErrorInfoProvider, Sendable { /// Returns information used to determine how & if to retry an error. @@ -41,6 +43,21 @@ public enum DefaultRetryErrorInfoProvider: RetryErrorInfoProvider, Sendable { // NSURLErrorTimedOut = -1001 // "The request timed out." return .init(errorType: .transient, retryAfterHint: nil, isTimeout: true) + } else if let crtError = error as? CommonRunTimeError, + case .crtError(let crtErrorStruct) = crtError, + crtErrorStruct.code == 1051 { + // Retries CRTError(code: 1051, message: "socket is closed.", name: "AWS_IO_SOCKET_CLOSED")) + return .init(errorType: .transient, retryAfterHint: nil, isTimeout: false) + } else if let crtError = error as? CommonRunTimeError, + case .crtError(let crtErrorStruct) = crtError, + crtErrorStruct.code == 1048 { + // Retries CRTError(code: 1048, message: "socket operation timed out.", name: "AWS_IO_SOCKET_TIMEOUT")) + return .init(errorType: .transient, retryAfterHint: nil, isTimeout: true) + } else if let crtError = error as? CommonRunTimeError, + case .crtError(let crtErrorStruct) = crtError, + crtErrorStruct.code == 1067 { + // Retries CRTError(code: 1067, message: "Channel shutdown due to tls negotiation timeout", name: "AWS_IO_TLS_NEGOTIATION_TIMEOUT")) + return .init(errorType: .transient, retryAfterHint: nil, isTimeout: true) } return nil }