Skip to content

Commit 7e7ee6e

Browse files
authored
chore: add missing throttling errors (#1205)
1 parent af4b039 commit 7e7ee6e

File tree

4 files changed

+14
-53
lines changed

4 files changed

+14
-53
lines changed

packages/middleware-retry/src/retryDecider.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { RETRYABLE_STATUS_CODES } from "./constants";
22
import {
33
isClockSkewError,
4-
isStillProcessingError,
54
isThrottlingError
65
} from "@aws-sdk/service-error-classification";
76
import { MetadataBearer, SdkError } from "@aws-sdk/types";
@@ -23,11 +22,7 @@ export const defaultRetryDecider = (error: SdkError) => {
2322
return true;
2423
}
2524

26-
return (
27-
isStillProcessingError(error) ||
28-
isThrottlingError(error) ||
29-
isClockSkewError(error)
30-
);
25+
return isThrottlingError(error) || isClockSkewError(error);
3126
};
3227

3328
function hasMetadata(error: any): error is MetadataBearer {

packages/service-error-classification/src/constants.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,24 @@ export const CLOCK_SKEW_ERROR_CODES = [
1414
"SignatureDoesNotMatch"
1515
];
1616

17-
/**
18-
* Errors encountered when the state presumed by an operation is not yet ready.
19-
*/
20-
export const STILL_PROCESSING_ERROR_CODES = ["PriorRequestNotComplete"];
21-
2217
/**
2318
* Errors that indicate the SDK is being throttled.
2419
*
2520
* These errors are always retryable.
2621
*/
2722
export const THROTTLING_ERROR_CODES = [
28-
"BandwidthLimitExceeded",
23+
"Throttling",
24+
"ThrottlingException",
25+
"ThrottledException",
26+
"RequestThrottledException",
27+
"TooManyRequestsException",
2928
"ProvisionedThroughputExceededException",
29+
"TransactionInProgressException",
3030
"RequestLimitExceeded",
31+
"BandwidthLimitExceeded",
32+
"LimitExceededException",
3133
"RequestThrottled",
32-
"RequestThrottledException",
3334
"SlowDown",
34-
"ThrottledException",
35-
"Throttling",
36-
"ThrottlingException",
37-
"TooManyRequestsException"
35+
"PriorRequestNotComplete",
36+
"EC2ThrottledException"
3837
];

packages/service-error-classification/src/index.spec.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
import {
2-
CLOCK_SKEW_ERROR_CODES,
3-
STILL_PROCESSING_ERROR_CODES,
4-
THROTTLING_ERROR_CODES
5-
} from "./constants";
6-
import {
7-
isClockSkewError,
8-
isStillProcessingError,
9-
isThrottlingError
10-
} from "./index";
1+
import { CLOCK_SKEW_ERROR_CODES, THROTTLING_ERROR_CODES } from "./constants";
2+
import { isClockSkewError, isThrottlingError } from "./index";
113

124
const checkForErrorType = (
135
isErrorTypeFunc: (error: Error) => boolean,
@@ -37,24 +29,6 @@ describe("isClockSkewError", () => {
3729
}
3830
});
3931

40-
describe("isStillProcessingError", () => {
41-
STILL_PROCESSING_ERROR_CODES.forEach(name => {
42-
it(`should declare error with the name "${name}" to be a StillProcessing error`, () => {
43-
checkForErrorType(isStillProcessingError, name, true);
44-
});
45-
});
46-
47-
while (true) {
48-
const name = Math.random().toString(36).substring(2);
49-
if (!STILL_PROCESSING_ERROR_CODES.includes(name)) {
50-
it(`should not declare error with the name "${name}" to be a StillProcessing error`, () => {
51-
checkForErrorType(isStillProcessingError, name, false);
52-
});
53-
break;
54-
}
55-
}
56-
});
57-
5832
describe("isThrottlingError", () => {
5933
THROTTLING_ERROR_CODES.forEach(name => {
6034
it(`should declare error with the name "${name}" to be a Throttling error`, () => {
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
import {
2-
CLOCK_SKEW_ERROR_CODES,
3-
STILL_PROCESSING_ERROR_CODES,
4-
THROTTLING_ERROR_CODES
5-
} from "./constants";
1+
import { CLOCK_SKEW_ERROR_CODES, THROTTLING_ERROR_CODES } from "./constants";
62

73
export const isClockSkewError = (error: Error) =>
84
CLOCK_SKEW_ERROR_CODES.includes(error.name);
95

10-
export const isStillProcessingError = (error: Error) =>
11-
STILL_PROCESSING_ERROR_CODES.includes(error.name);
12-
136
export const isThrottlingError = (error: Error) =>
147
THROTTLING_ERROR_CODES.includes(error.name);

0 commit comments

Comments
 (0)