Skip to content

Commit 22c4f08

Browse files
committed
Added EC2ThrottledException as a throttling exception
1 parent 0deaff0 commit 22c4f08

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"category": "Amazon EC2",
3+
"type": "feature",
4+
"description": "Adds EC2ThrottledException as a recognized throttling exception to be retried"
5+
}

core/aws-core/src/main/java/software/amazon/awssdk/awscore/internal/AwsErrorCode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public final class AwsErrorCode {
4545
throttlingErrorCodes.add("RequestThrottled");
4646
throttlingErrorCodes.add("RequestThrottledException");
4747
throttlingErrorCodes.add("LimitExceededException");
48+
throttlingErrorCodes.add("EC2ThrottledException");
4849
THROTTLING_ERROR_CODES = unmodifiableSet(throttlingErrorCodes);
4950

5051
Set<String> definiteClockSkewErrorCodes = new HashSet<>(3);

core/aws-core/src/test/java/software/amazon/awssdk/awscore/retry/AwsRetryPolicyTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ public void doesNotRetryOnNonRetryableErrorCode() {
102102
assertFalse(shouldRetry(applyErrorCode("ValidationError")));
103103
}
104104

105+
@Test
106+
public void retriesOnEC2ThrottledException() {
107+
AwsServiceException ex = AwsServiceException.builder()
108+
.awsErrorDetails(AwsErrorDetails.builder()
109+
.errorCode("EC2ThrottledException")
110+
.build())
111+
.build();
112+
113+
assertTrue(shouldRetry(b -> b.exception(ex)));
114+
}
115+
105116
private boolean shouldRetry(Consumer<RetryPolicyContext.Builder> builder) {
106117
return defaultRetryCondition().shouldRetry(RetryPolicyContext.builder().applyMutation(builder).build());
107118
}

0 commit comments

Comments
 (0)