From 3801f3e6bbca7705a9d5102128f097df0817bfee Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Tue, 26 May 2020 15:13:51 +0000 Subject: [PATCH 1/2] chore: update list of Throttling Error codes --- .../src/constants.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/service-error-classification/src/constants.ts b/packages/service-error-classification/src/constants.ts index c7f91e394a36..bc1edfdb6f0a 100644 --- a/packages/service-error-classification/src/constants.ts +++ b/packages/service-error-classification/src/constants.ts @@ -25,14 +25,18 @@ export const STILL_PROCESSING_ERROR_CODES = ["PriorRequestNotComplete"]; * These errors are always retryable. */ export const THROTTLING_ERROR_CODES = [ - "BandwidthLimitExceeded", + "Throttling", + "ThrottlingException", + "ThrottledException", + "RequestThrottledException", + "TooManyRequestsException", "ProvisionedThroughputExceededException", + "TransactionInProgressException", "RequestLimitExceeded", + "BandwidthLimitExceeded", + "LimitExceededException", "RequestThrottled", - "RequestThrottledException", "SlowDown", - "ThrottledException", - "Throttling", - "ThrottlingException", - "TooManyRequestsException" + "PriorRequestNotComplete", + "EC2ThrottledException" ]; From d7028004761441dcc4a2eba7c82ecb98ece81847 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Tue, 26 May 2020 23:41:07 +0000 Subject: [PATCH 2/2] chore: remove isStillProcessingError reason: it's now part of Throttling Errors list --- packages/middleware-retry/src/retryDecider.ts | 7 +---- .../src/constants.ts | 5 ---- .../src/index.spec.ts | 30 ++----------------- .../service-error-classification/src/index.ts | 9 +----- 4 files changed, 4 insertions(+), 47 deletions(-) diff --git a/packages/middleware-retry/src/retryDecider.ts b/packages/middleware-retry/src/retryDecider.ts index 221ef3d27607..2d8e7b9fc390 100644 --- a/packages/middleware-retry/src/retryDecider.ts +++ b/packages/middleware-retry/src/retryDecider.ts @@ -1,7 +1,6 @@ import { RETRYABLE_STATUS_CODES } from "./constants"; import { isClockSkewError, - isStillProcessingError, isThrottlingError } from "@aws-sdk/service-error-classification"; import { MetadataBearer, SdkError } from "@aws-sdk/types"; @@ -23,11 +22,7 @@ export const defaultRetryDecider = (error: SdkError) => { return true; } - return ( - isStillProcessingError(error) || - isThrottlingError(error) || - isClockSkewError(error) - ); + return isThrottlingError(error) || isClockSkewError(error); }; function hasMetadata(error: any): error is MetadataBearer { diff --git a/packages/service-error-classification/src/constants.ts b/packages/service-error-classification/src/constants.ts index bc1edfdb6f0a..755f54be5172 100644 --- a/packages/service-error-classification/src/constants.ts +++ b/packages/service-error-classification/src/constants.ts @@ -14,11 +14,6 @@ export const CLOCK_SKEW_ERROR_CODES = [ "SignatureDoesNotMatch" ]; -/** - * Errors encountered when the state presumed by an operation is not yet ready. - */ -export const STILL_PROCESSING_ERROR_CODES = ["PriorRequestNotComplete"]; - /** * Errors that indicate the SDK is being throttled. * diff --git a/packages/service-error-classification/src/index.spec.ts b/packages/service-error-classification/src/index.spec.ts index 636392936ec5..5a75c0fd3633 100644 --- a/packages/service-error-classification/src/index.spec.ts +++ b/packages/service-error-classification/src/index.spec.ts @@ -1,13 +1,5 @@ -import { - CLOCK_SKEW_ERROR_CODES, - STILL_PROCESSING_ERROR_CODES, - THROTTLING_ERROR_CODES -} from "./constants"; -import { - isClockSkewError, - isStillProcessingError, - isThrottlingError -} from "./index"; +import { CLOCK_SKEW_ERROR_CODES, THROTTLING_ERROR_CODES } from "./constants"; +import { isClockSkewError, isThrottlingError } from "./index"; const checkForErrorType = ( isErrorTypeFunc: (error: Error) => boolean, @@ -37,24 +29,6 @@ describe("isClockSkewError", () => { } }); -describe("isStillProcessingError", () => { - STILL_PROCESSING_ERROR_CODES.forEach(name => { - it(`should declare error with the name "${name}" to be a StillProcessing error`, () => { - checkForErrorType(isStillProcessingError, name, true); - }); - }); - - while (true) { - const name = Math.random().toString(36).substring(2); - if (!STILL_PROCESSING_ERROR_CODES.includes(name)) { - it(`should not declare error with the name "${name}" to be a StillProcessing error`, () => { - checkForErrorType(isStillProcessingError, name, false); - }); - break; - } - } -}); - describe("isThrottlingError", () => { THROTTLING_ERROR_CODES.forEach(name => { it(`should declare error with the name "${name}" to be a Throttling error`, () => { diff --git a/packages/service-error-classification/src/index.ts b/packages/service-error-classification/src/index.ts index 4a2125a76509..558ea92c589b 100644 --- a/packages/service-error-classification/src/index.ts +++ b/packages/service-error-classification/src/index.ts @@ -1,14 +1,7 @@ -import { - CLOCK_SKEW_ERROR_CODES, - STILL_PROCESSING_ERROR_CODES, - THROTTLING_ERROR_CODES -} from "./constants"; +import { CLOCK_SKEW_ERROR_CODES, THROTTLING_ERROR_CODES } from "./constants"; export const isClockSkewError = (error: Error) => CLOCK_SKEW_ERROR_CODES.includes(error.name); -export const isStillProcessingError = (error: Error) => - STILL_PROCESSING_ERROR_CODES.includes(error.name); - export const isThrottlingError = (error: Error) => THROTTLING_ERROR_CODES.includes(error.name);