Skip to content

Commit 2f6585c

Browse files
handle transient network error
1 parent f69be0d commit 2f6585c

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/common/error.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Licensed under the MIT license.
33

44
import { isRestError } from "@azure/core-rest-pipeline";
5-
import { AuthenticationError } from "@azure/identity";
6-
75

86
/**
97
* Error thrown when an operation cannot be performed by the Azure App Configuration provider.
@@ -36,14 +34,12 @@ export class KeyVaultReferenceError extends Error {
3634
}
3735

3836
export function isFailoverableError(error: any): boolean {
39-
if (error instanceof AuthenticationError) {
40-
return true;
41-
}
4237
if (!isRestError(error)) {
4338
return false;
4439
}
45-
// ENOTFOUND: DNS lookup failed, ENOENT: no such file or directory
46-
if (error.code === "ENOTFOUND" || error.code === "ENOENT") {
40+
// https://nodejs.org/api/errors.html#common-system-errors
41+
// ENOTFOUND: DNS lookup failed, ENOENT: no such file or directory, ECONNREFUSED: connection refused, ECONNRESET: connection reset by peer, ETIMEDOUT: connection timed out
42+
if (error.code === "ENOTFOUND" || error.code === "ENOENT" || error.code === "ECONNREFUSED" || error.code === "ECONNRESET" || error.code === "ETIMEDOUT") {
4743
return true;
4844
}
4945
// 401 Unauthorized, 403 Forbidden, 408 Request Timeout, 429 Too Many Requests, 5xx Server Errors

0 commit comments

Comments
 (0)