Skip to content

Commit 1dd9064

Browse files
fix(auth): add more errors to isNetworkError() (#5560)
These showed up in telemetry during `aws_refreshCredentials` --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: Nikolas Komonen <[email protected]>
1 parent 5eea5f9 commit 1dd9064

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

packages/core/src/shared/errors.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ export function isNetworkError(err?: unknown): err is Error & { code: string } {
829829
'EAI_FAIL',
830830
'502', // This may be irrelevant as isBadResponseCode() may be all we need
831831
'InternalServerException',
832+
'ERR_SSL_WRONG_VERSION_NUMBER',
832833
].includes(err.code)
833834
}
834835

@@ -890,7 +891,7 @@ export function isError(err: Error, id: string, messageIncludes: string = '') {
890891
* These are the errors explicitly seen in telemetry. We can instead do any non-200 response code
891892
* later, but this will give us better visibility in to the actual error codes we are currently getting.
892893
*/
893-
const errorResponseCodes = [302, 403, 502]
894+
const errorResponseCodes = [302, 403, 404, 502, 503]
894895

895896
/**
896897
* Returns true if the given error is a bad response code

packages/core/src/test/shared/errors.test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -526,13 +526,6 @@ describe('util', function () {
526526
reponseCodeErr.name = '502'
527527
assert.deepStrictEqual(isNetworkError(reponseCodeErr), true, 'Did not indicate 502 error as network error')
528528
reponseCodeErr = new Error()
529-
reponseCodeErr.name = '503'
530-
assert.deepStrictEqual(
531-
isNetworkError(reponseCodeErr),
532-
false,
533-
'Incorrectly indicated 503 error as network error'
534-
)
535-
reponseCodeErr = new Error()
536529
reponseCodeErr.name = '200'
537530
assert.deepStrictEqual(
538531
isNetworkError(reponseCodeErr),

0 commit comments

Comments
 (0)