Skip to content

Commit d3c6094

Browse files
authored
[core-amqp] Mark more network errors as retryable (#33230)
### Packages impacted by this PR @azure/core-amqp ### Issues associated with this PR #33205 ### Describe the problem that is addressed by this PR Some network errors are not being retried. ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? It makes sense to retry network errors. ### Are there test cases added in this PR? _(If not, why?)_ Yes ### Provide a list of related PRs _(if any)_ N/A ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [x] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [x] Added a changelog (if necessary)
1 parent d47f5b3 commit d3c6094

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

sdk/core/core-amqp/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Bugs Fixed
1010

11+
- Designates `EAI_AGAIN` and `EADDRNOTAVAIL` errors as timeout errors to be retryable.
12+
1113
### Other Changes
1214

1315
## 4.3.5 (2025-02-06)

sdk/core/core-amqp/review/core-amqp.api.md

+4
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,10 @@ export const StandardAbortMessage = "The operation was aborted.";
572572

573573
// @public
574574
export enum SystemErrorConditionMapper {
575+
// (undocumented)
576+
EADDRNOTAVAIL = "com.microsoft:timeout",
577+
// (undocumented)
578+
EAI_AGAIN = "com.microsoft:timeout",
575579
// (undocumented)
576580
EBUSY = "com.microsoft:server-busy",
577581
// (undocumented)

sdk/core/core-amqp/src/errors.ts

+2
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,8 @@ export enum SystemErrorConditionMapper {
595595
ENETRESET = "com.microsoft:timeout",
596596
ENETUNREACH = "com.microsoft:timeout",
597597
ENONET = "com.microsoft:timeout",
598+
EADDRNOTAVAIL = "com.microsoft:timeout",
599+
EAI_AGAIN = "com.microsoft:timeout",
598600
/* eslint-enable @typescript-eslint/no-duplicate-enum-values */
599601
}
600602

sdk/core/core-amqp/test/errors.spec.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,18 @@ describe("Errors", function () {
184184
syscall: "read",
185185
message: "code: ENOTFOUND, errno: ENOTFOUND, syscall: read",
186186
},
187+
{
188+
code: "EADDRNOTAVAIL",
189+
errno: "EADDRNOTAVAIL",
190+
syscall: "read",
191+
message: "code: EADDRNOTAVAIL, errno: EADDRNOTAVAIL, syscall: read",
192+
},
193+
{
194+
code: "EAI_AGAIN",
195+
errno: "EAI_AGAIN",
196+
syscall: "read",
197+
message: "code: EAI_AGAIN, errno: EAI_AGAIN, syscall: read",
198+
},
187199
{
188200
code: "ESOMETHINGRANDOM",
189201
errno: "ESOMETHINGRANDOM",
@@ -197,7 +209,11 @@ describe("Errors", function () {
197209
const translatedError = Errors.translate(mapping as any) as Errors.MessagingError;
198210
assert.equal(translatedError.name, "MessagingError");
199211
assert.equal(translatedError.code, mapping.code);
200-
if (["ECONNRESET", "ECONNREFUSED", "EBUSY"].indexOf(mapping.code) !== -1) {
212+
if (
213+
["ECONNRESET", "ECONNREFUSED", "EBUSY", "EAI_AGAIN", "EADDRNOTAVAIL"].indexOf(
214+
mapping.code,
215+
) !== -1
216+
) {
201217
assert.isTrue(translatedError.retryable);
202218
} else {
203219
assert.isFalse(translatedError.retryable);

0 commit comments

Comments
 (0)