Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SNS client to retry on Throttling error #149

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public enum SimpleNotificationClientError: Swift.Error {

public func isRetriable() -> Bool? {
switch self {
case .filterPolicyLimitExceeded, .kMSThrottling, .subscriptionLimitExceeded, .throttled, .topicLimitExceeded:
case .filterPolicyLimitExceeded, .kMSThrottling, .subscriptionLimitExceeded, .throttled, .throttling, .topicLimitExceeded:
return true
default:
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,24 @@ private let subscriptionLimitExceededIdentity = "SubscriptionLimitExceeded"
private let tagLimitExceededIdentity = "TagLimitExceeded"
private let tagPolicyIdentity = "TagPolicy"
private let throttledIdentity = "Throttled"
private let throttlingIdentity = "Throttling"
private let tooManyEntriesInBatchRequestIdentity = "TooManyEntriesInBatchRequest"
private let topicLimitExceededIdentity = "TopicLimitExceeded"
private let userErrorIdentity = "UserError"
private let validationIdentity = "ValidationException"
private let verificationIdentity = "VerificationException"
private let __accessDeniedIdentity = "AccessDenied"

public struct SimpleNotificationErrorPayload: Codable {
public let type: String
public let message: String

enum CodingKeys: String, CodingKey {
case type = "Code"
case message = "Message"
}
}

public enum SimpleNotificationError: Swift.Error, Decodable {
case authorizationError(AuthorizationErrorException)
case batchEntryIdsNotDistinct(BatchEntryIdsNotDistinctException)
Expand Down Expand Up @@ -99,6 +110,7 @@ public enum SimpleNotificationError: Swift.Error, Decodable {
case tagLimitExceeded(TagLimitExceededException)
case tagPolicy(TagPolicyException)
case throttled(ThrottledException)
case throttling(SimpleNotificationErrorPayload)
case tooManyEntriesInBatchRequest(TooManyEntriesInBatchRequestException)
case topicLimitExceeded(TopicLimitExceededException)
case userError(UserErrorException)
Expand Down Expand Up @@ -210,6 +222,9 @@ public enum SimpleNotificationError: Swift.Error, Decodable {
case throttledIdentity:
let errorPayload = try ThrottledException(from: decoder)
self = SimpleNotificationError.throttled(errorPayload)
case throttlingIdentity:
let errorPayload = try SimpleNotificationErrorPayload(from: decoder)
self = SimpleNotificationError.throttling(errorPayload)
case tooManyEntriesInBatchRequestIdentity:
let errorPayload = try TooManyEntriesInBatchRequestException(from: decoder)
self = SimpleNotificationError.tooManyEntriesInBatchRequest(errorPayload)
Expand Down
Loading