Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
Expand Down
Loading